@celljs/ta-web 4.28.0 → 4.30.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/assistant/assistant-thread.js +15 -2
- package/esm/browser/assistant/call-scenes.d.ts +5 -4
- package/esm/browser/assistant/call-scenes.js +10 -7
- package/esm/browser/chat/chat-protocol.d.ts +2 -0
- package/esm/browser/chat/chat-shown.d.ts +3 -1
- package/esm/browser/chat/chat-shown.js +25 -3
- package/esm/browser/chat/chat-view.js +1 -1
- package/esm/browser/chat/chat.d.ts +5 -1
- package/esm/browser/chat/chat.js +32 -16
- package/esm/browser/components/account-menu.d.ts +6 -16
- package/esm/browser/components/account-menu.js +47 -101
- package/esm/browser/components/app-contexts.js +7 -4
- package/esm/browser/components/app-nav.js +4 -4
- package/esm/browser/components/chat-list-row.js +7 -2
- package/esm/browser/components/chat-tag.d.ts +20 -0
- package/esm/browser/components/chat-tag.js +103 -0
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/composer-box-protocol.d.ts +2 -0
- package/esm/browser/components/composer-box.js +20 -1
- package/esm/browser/components/composer-emoji.d.ts +22 -0
- package/esm/browser/components/composer-emoji.js +50 -0
- package/esm/browser/components/custom-host.js +1 -1
- package/esm/browser/components/discover-view.d.ts +4 -3
- package/esm/browser/components/discover-view.js +5 -4
- package/esm/browser/components/editor-area.js +1 -1
- package/esm/browser/components/emoji-panel.d.ts +22 -0
- package/esm/browser/components/emoji-panel.js +54 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/launcher-surface.js +1 -1
- package/esm/browser/components/markdown.d.ts +6 -1
- package/esm/browser/components/markdown.js +6 -2
- package/esm/browser/components/me-rows.d.ts +24 -0
- package/esm/browser/components/me-rows.js +19 -0
- package/esm/browser/components/me-view.d.ts +2 -1
- package/esm/browser/components/me-view.js +3 -2
- package/esm/browser/components/message-list.js +47 -7
- package/esm/browser/components/message-steps.js +13 -0
- package/esm/browser/components/nav-places.js +1 -1
- package/esm/browser/components/session-view.js +6 -1
- package/esm/browser/components/settings-choices.js +3 -0
- package/esm/browser/components/settings-controls.d.ts +13 -0
- package/esm/browser/components/settings-controls.js +19 -0
- package/esm/browser/components/settings-more.d.ts +1 -1
- package/esm/browser/components/settings-more.js +28 -39
- package/esm/browser/components/settings-parts.d.ts +4 -2
- package/esm/browser/components/settings-parts.js +14 -9
- package/esm/browser/components/settings-view.js +2 -6
- package/esm/browser/components/web-composer.d.ts +1 -1
- package/esm/browser/components/web-composer.js +2 -2
- package/esm/browser/device/file-save.d.ts +31 -0
- package/esm/browser/device/file-save.js +80 -0
- package/esm/browser/extension/extension-view.d.ts +9 -0
- package/esm/browser/extension/extension-view.js +7 -0
- package/esm/browser/extension/icons.js +2 -1
- package/esm/browser/extension/web-api-call.d.ts +45 -0
- package/esm/browser/extension/web-api-chats.d.ts +29 -0
- package/esm/browser/extension/web-api-components.d.ts +4 -0
- package/esm/browser/extension/web-api-contributions.d.ts +13 -14
- package/esm/browser/extension/web-api-desktop.d.ts +16 -1
- package/esm/browser/extension/web-api-desktop.js +1 -0
- package/esm/browser/extension/web-extension-api.d.ts +9 -12
- package/esm/browser/extension/web-extension-code.d.ts +15 -8
- package/esm/browser/extension/web-extension-code.js +25 -27
- package/esm/browser/extension/web-extension-context.js +4 -0
- package/esm/browser/extension/web-extension-protocol.d.ts +15 -1
- package/esm/browser/extension/web-extension-protocol.js +2 -0
- package/esm/browser/extension/web-extension-run.d.ts +4 -2
- package/esm/browser/extension/web-extension-run.js +10 -4
- package/esm/browser/extension/web-extensions-running.d.ts +3 -0
- package/esm/browser/extension/web-extensions-running.js +20 -7
- package/esm/browser/extension/web-extensions.js +5 -1
- package/esm/browser/extension/web-metrics.d.ts +32 -0
- package/esm/browser/extension/web-metrics.js +98 -0
- package/esm/browser/extension/web-pages.d.ts +2 -0
- package/esm/browser/extension/web-pages.js +2 -0
- package/esm/browser/i18n/en/account.d.ts +202 -0
- package/esm/browser/i18n/en/account.js +205 -0
- package/esm/browser/i18n/en/assistant.d.ts +129 -0
- package/esm/browser/i18n/en/assistant.js +130 -0
- package/esm/browser/i18n/en/call.d.ts +86 -0
- package/esm/browser/i18n/en/call.js +87 -0
- package/esm/browser/i18n/en/chat.d.ts +213 -0
- package/esm/browser/i18n/en/chat.js +214 -0
- package/esm/browser/i18n/en/common.d.ts +99 -0
- package/esm/browser/i18n/en/common.js +101 -0
- package/esm/browser/i18n/en/console.d.ts +230 -0
- package/esm/browser/i18n/en/console.js +232 -0
- package/esm/browser/i18n/en/discover.d.ts +117 -0
- package/esm/browser/i18n/en/discover.js +119 -0
- package/esm/browser/i18n/en/service.d.ts +242 -0
- package/esm/browser/i18n/en/service.js +245 -0
- package/esm/browser/i18n/en/settings.d.ts +213 -0
- package/esm/browser/i18n/en/settings.js +214 -0
- package/esm/browser/i18n/en/tools.d.ts +85 -0
- package/esm/browser/i18n/en/tools.js +87 -0
- package/esm/browser/i18n/ja/account.d.ts +2 -0
- package/esm/browser/i18n/ja/account.js +202 -0
- package/esm/browser/i18n/ja/assistant.d.ts +2 -0
- package/esm/browser/i18n/ja/assistant.js +129 -0
- package/esm/browser/i18n/ja/call.d.ts +2 -0
- package/esm/browser/i18n/ja/call.js +86 -0
- package/esm/browser/i18n/ja/chat.d.ts +2 -0
- package/esm/browser/i18n/ja/chat.js +213 -0
- package/esm/browser/i18n/ja/common.d.ts +2 -0
- package/esm/browser/i18n/ja/common.js +99 -0
- package/esm/browser/i18n/ja/console.d.ts +2 -0
- package/esm/browser/i18n/ja/console.js +230 -0
- package/esm/browser/i18n/ja/discover.d.ts +2 -0
- package/esm/browser/i18n/ja/discover.js +117 -0
- package/esm/browser/i18n/ja/service.d.ts +2 -0
- package/esm/browser/i18n/ja/service.js +242 -0
- package/esm/browser/i18n/ja/settings.d.ts +2 -0
- package/esm/browser/i18n/ja/settings.js +213 -0
- package/esm/browser/i18n/ja/tools.d.ts +2 -0
- package/esm/browser/i18n/ja/tools.js +85 -0
- package/esm/browser/i18n/locales.d.ts +1136 -1136
- package/esm/browser/i18n/messages-ja.js +20 -1586
- package/esm/browser/i18n/messages-zh-tw.d.ts +0 -1
- package/esm/browser/i18n/messages-zh-tw.js +20 -1587
- package/esm/browser/i18n/messages.d.ts +1139 -1136
- package/esm/browser/i18n/messages.js +44 -3183
- package/esm/browser/i18n/zh/account.d.ts +2 -0
- package/esm/browser/i18n/zh/account.js +203 -0
- package/esm/browser/i18n/zh/assistant.d.ts +2 -0
- package/esm/browser/i18n/zh/assistant.js +129 -0
- package/esm/browser/i18n/zh/call.d.ts +2 -0
- package/esm/browser/i18n/zh/call.js +86 -0
- package/esm/browser/i18n/zh/chat.d.ts +2 -0
- package/esm/browser/i18n/zh/chat.js +213 -0
- package/esm/browser/i18n/zh/common.d.ts +2 -0
- package/esm/browser/i18n/zh/common.js +99 -0
- package/esm/browser/i18n/zh/console.d.ts +2 -0
- package/esm/browser/i18n/zh/console.js +230 -0
- package/esm/browser/i18n/zh/discover.d.ts +2 -0
- package/esm/browser/i18n/zh/discover.js +117 -0
- package/esm/browser/i18n/zh/service.d.ts +2 -0
- package/esm/browser/i18n/zh/service.js +242 -0
- package/esm/browser/i18n/zh/settings.d.ts +2 -0
- package/esm/browser/i18n/zh/settings.js +213 -0
- package/esm/browser/i18n/zh/tools.d.ts +2 -0
- package/esm/browser/i18n/zh/tools.js +86 -0
- package/esm/browser/i18n/zh-tw/account.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/account.js +202 -0
- package/esm/browser/i18n/zh-tw/assistant.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/assistant.js +129 -0
- package/esm/browser/i18n/zh-tw/call.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/call.js +86 -0
- package/esm/browser/i18n/zh-tw/chat.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/chat.js +213 -0
- package/esm/browser/i18n/zh-tw/common.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/common.js +99 -0
- package/esm/browser/i18n/zh-tw/console.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/console.js +230 -0
- package/esm/browser/i18n/zh-tw/discover.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/discover.js +117 -0
- package/esm/browser/i18n/zh-tw/service.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/service.js +242 -0
- package/esm/browser/i18n/zh-tw/settings.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/settings.js +213 -0
- package/esm/browser/i18n/zh-tw/tools.d.ts +2 -0
- package/esm/browser/i18n/zh-tw/tools.js +85 -0
- package/esm/browser/offline/device-values.d.ts +4 -0
- package/esm/browser/offline/device-values.js +10 -0
- package/esm/browser/pwa/page-build.d.ts +15 -0
- package/esm/browser/pwa/page-build.js +45 -0
- package/esm/browser/settings/settings-protocol.d.ts +2 -0
- package/esm/browser/settings/settings-protocol.js +2 -0
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +3 -0
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +6 -0
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation-column.js +17 -0
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +5 -0
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +0 -7
- package/esm/browser/style/video-call.d.ts +1 -1
- package/esm/browser/style/video-call.js +15 -4
- package/esm/browser/util/call-transcript.d.ts +16 -0
- package/esm/browser/util/call-transcript.js +110 -0
- package/esm/browser/util/process.d.ts +6 -0
- package/esm/browser/util/process.js +18 -5
- package/esm/browser/video-call/call-people.d.ts +21 -0
- package/esm/browser/video-call/call-people.js +29 -0
- package/esm/browser/video-call/clip-plan.d.ts +11 -2
- package/esm/browser/video-call/clip-plan.js +19 -3
- package/esm/browser/video-call/face-camera.d.ts +93 -0
- package/esm/browser/video-call/face-camera.js +192 -0
- package/esm/browser/video-call/face-files.d.ts +43 -5
- package/esm/browser/video-call/face-files.js +73 -18
- package/esm/browser/video-call/face-moves.d.ts +68 -0
- package/esm/browser/video-call/face-moves.js +180 -0
- package/esm/browser/video-call/face-stage.d.ts +139 -0
- package/esm/browser/video-call/face-stage.js +219 -0
- package/esm/browser/video-call/mouth-layer.d.ts +81 -0
- package/esm/browser/video-call/mouth-layer.js +241 -0
- package/esm/browser/video-call/video-call-view.js +44 -4
- package/esm/browser/video-call/video-face.d.ts +11 -5
- package/esm/browser/video-call/video-face.js +302 -328
- package/esm/browser/workbench.d.ts +8 -0
- package/esm/browser/workbench.js +37 -1
- package/lib/browser/assistant/assistant-thread.js +15 -2
- package/lib/browser/assistant/call-scenes.d.ts +5 -4
- package/lib/browser/assistant/call-scenes.js +10 -7
- package/lib/browser/chat/chat-protocol.d.ts +2 -0
- package/lib/browser/chat/chat-shown.d.ts +3 -1
- package/lib/browser/chat/chat-shown.js +25 -3
- package/lib/browser/chat/chat-view.js +1 -1
- package/lib/browser/chat/chat.d.ts +5 -1
- package/lib/browser/chat/chat.js +32 -16
- package/lib/browser/components/account-menu.d.ts +6 -16
- package/lib/browser/components/account-menu.js +45 -99
- package/lib/browser/components/app-contexts.js +6 -3
- package/lib/browser/components/app-nav.js +4 -4
- package/lib/browser/components/chat-list-row.js +7 -2
- package/lib/browser/components/chat-tag.d.ts +21 -0
- package/lib/browser/components/chat-tag.js +142 -0
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/composer-box-protocol.d.ts +2 -0
- package/lib/browser/components/composer-box.js +20 -1
- package/lib/browser/components/composer-emoji.d.ts +23 -0
- package/lib/browser/components/composer-emoji.js +87 -0
- package/lib/browser/components/custom-host.js +1 -1
- package/lib/browser/components/discover-view.d.ts +4 -3
- package/lib/browser/components/discover-view.js +5 -4
- package/lib/browser/components/editor-area.js +1 -1
- package/lib/browser/components/emoji-panel.d.ts +23 -0
- package/lib/browser/components/emoji-panel.js +90 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/launcher-surface.js +1 -1
- package/lib/browser/components/markdown.d.ts +6 -1
- package/lib/browser/components/markdown.js +6 -2
- package/lib/browser/components/me-rows.d.ts +25 -0
- package/lib/browser/components/me-rows.js +22 -0
- package/lib/browser/components/me-view.d.ts +2 -1
- package/lib/browser/components/me-view.js +3 -2
- package/lib/browser/components/message-list.js +46 -6
- package/lib/browser/components/message-steps.js +13 -0
- package/lib/browser/components/nav-places.js +1 -1
- package/lib/browser/components/session-view.js +6 -1
- package/lib/browser/components/settings-choices.js +3 -0
- package/lib/browser/components/settings-controls.d.ts +13 -0
- package/lib/browser/components/settings-controls.js +19 -0
- package/lib/browser/components/settings-more.d.ts +1 -1
- package/lib/browser/components/settings-more.js +27 -38
- package/lib/browser/components/settings-parts.d.ts +4 -2
- package/lib/browser/components/settings-parts.js +13 -8
- package/lib/browser/components/settings-view.js +2 -6
- package/lib/browser/components/web-composer.d.ts +1 -1
- package/lib/browser/components/web-composer.js +2 -2
- package/lib/browser/device/file-save.d.ts +32 -0
- package/lib/browser/device/file-save.js +83 -0
- package/lib/browser/extension/extension-view.d.ts +9 -0
- package/lib/browser/extension/extension-view.js +8 -1
- package/lib/browser/extension/icons.js +1 -0
- package/lib/browser/extension/web-api-call.d.ts +45 -0
- package/lib/browser/extension/web-api-chats.d.ts +29 -0
- package/lib/browser/extension/web-api-components.d.ts +4 -0
- package/lib/browser/extension/web-api-contributions.d.ts +13 -14
- package/lib/browser/extension/web-api-desktop.d.ts +16 -1
- package/lib/browser/extension/web-api-desktop.js +1 -0
- package/lib/browser/extension/web-extension-api.d.ts +9 -12
- package/lib/browser/extension/web-extension-code.d.ts +15 -8
- package/lib/browser/extension/web-extension-code.js +25 -27
- package/lib/browser/extension/web-extension-context.js +4 -0
- package/lib/browser/extension/web-extension-protocol.d.ts +15 -1
- package/lib/browser/extension/web-extension-protocol.js +2 -0
- package/lib/browser/extension/web-extension-run.d.ts +4 -2
- package/lib/browser/extension/web-extension-run.js +10 -4
- package/lib/browser/extension/web-extensions-running.d.ts +3 -0
- package/lib/browser/extension/web-extensions-running.js +20 -7
- package/lib/browser/extension/web-extensions.js +5 -1
- package/lib/browser/extension/web-metrics.d.ts +33 -0
- package/lib/browser/extension/web-metrics.js +102 -0
- package/lib/browser/extension/web-pages.d.ts +2 -0
- package/lib/browser/extension/web-pages.js +2 -0
- package/lib/browser/i18n/en/account.d.ts +203 -0
- package/lib/browser/i18n/en/account.js +208 -0
- package/lib/browser/i18n/en/assistant.d.ts +130 -0
- package/lib/browser/i18n/en/assistant.js +133 -0
- package/lib/browser/i18n/en/call.d.ts +87 -0
- package/lib/browser/i18n/en/call.js +90 -0
- package/lib/browser/i18n/en/chat.d.ts +214 -0
- package/lib/browser/i18n/en/chat.js +217 -0
- package/lib/browser/i18n/en/common.d.ts +100 -0
- package/lib/browser/i18n/en/common.js +104 -0
- package/lib/browser/i18n/en/console.d.ts +231 -0
- package/lib/browser/i18n/en/console.js +235 -0
- package/lib/browser/i18n/en/discover.d.ts +118 -0
- package/lib/browser/i18n/en/discover.js +122 -0
- package/lib/browser/i18n/en/service.d.ts +243 -0
- package/lib/browser/i18n/en/service.js +248 -0
- package/lib/browser/i18n/en/settings.d.ts +214 -0
- package/lib/browser/i18n/en/settings.js +217 -0
- package/lib/browser/i18n/en/tools.d.ts +86 -0
- package/lib/browser/i18n/en/tools.js +90 -0
- package/lib/browser/i18n/ja/account.d.ts +3 -0
- package/lib/browser/i18n/ja/account.js +205 -0
- package/lib/browser/i18n/ja/assistant.d.ts +3 -0
- package/lib/browser/i18n/ja/assistant.js +132 -0
- package/lib/browser/i18n/ja/call.d.ts +3 -0
- package/lib/browser/i18n/ja/call.js +89 -0
- package/lib/browser/i18n/ja/chat.d.ts +3 -0
- package/lib/browser/i18n/ja/chat.js +216 -0
- package/lib/browser/i18n/ja/common.d.ts +3 -0
- package/lib/browser/i18n/ja/common.js +102 -0
- package/lib/browser/i18n/ja/console.d.ts +3 -0
- package/lib/browser/i18n/ja/console.js +233 -0
- package/lib/browser/i18n/ja/discover.d.ts +3 -0
- package/lib/browser/i18n/ja/discover.js +120 -0
- package/lib/browser/i18n/ja/service.d.ts +3 -0
- package/lib/browser/i18n/ja/service.js +245 -0
- package/lib/browser/i18n/ja/settings.d.ts +3 -0
- package/lib/browser/i18n/ja/settings.js +216 -0
- package/lib/browser/i18n/ja/tools.d.ts +3 -0
- package/lib/browser/i18n/ja/tools.js +88 -0
- package/lib/browser/i18n/locales.d.ts +1136 -1136
- package/lib/browser/i18n/messages-ja.js +20 -1586
- package/lib/browser/i18n/messages-zh-tw.d.ts +0 -1
- package/lib/browser/i18n/messages-zh-tw.js +20 -1587
- package/lib/browser/i18n/messages.d.ts +1139 -1136
- package/lib/browser/i18n/messages.js +44 -3183
- package/lib/browser/i18n/zh/account.d.ts +3 -0
- package/lib/browser/i18n/zh/account.js +206 -0
- package/lib/browser/i18n/zh/assistant.d.ts +3 -0
- package/lib/browser/i18n/zh/assistant.js +132 -0
- package/lib/browser/i18n/zh/call.d.ts +3 -0
- package/lib/browser/i18n/zh/call.js +89 -0
- package/lib/browser/i18n/zh/chat.d.ts +3 -0
- package/lib/browser/i18n/zh/chat.js +216 -0
- package/lib/browser/i18n/zh/common.d.ts +3 -0
- package/lib/browser/i18n/zh/common.js +102 -0
- package/lib/browser/i18n/zh/console.d.ts +3 -0
- package/lib/browser/i18n/zh/console.js +233 -0
- package/lib/browser/i18n/zh/discover.d.ts +3 -0
- package/lib/browser/i18n/zh/discover.js +120 -0
- package/lib/browser/i18n/zh/service.d.ts +3 -0
- package/lib/browser/i18n/zh/service.js +245 -0
- package/lib/browser/i18n/zh/settings.d.ts +3 -0
- package/lib/browser/i18n/zh/settings.js +216 -0
- package/lib/browser/i18n/zh/tools.d.ts +3 -0
- package/lib/browser/i18n/zh/tools.js +89 -0
- package/lib/browser/i18n/zh-tw/account.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/account.js +205 -0
- package/lib/browser/i18n/zh-tw/assistant.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/assistant.js +132 -0
- package/lib/browser/i18n/zh-tw/call.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/call.js +89 -0
- package/lib/browser/i18n/zh-tw/chat.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/chat.js +216 -0
- package/lib/browser/i18n/zh-tw/common.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/common.js +102 -0
- package/lib/browser/i18n/zh-tw/console.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/console.js +233 -0
- package/lib/browser/i18n/zh-tw/discover.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/discover.js +120 -0
- package/lib/browser/i18n/zh-tw/service.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/service.js +245 -0
- package/lib/browser/i18n/zh-tw/settings.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/settings.js +216 -0
- package/lib/browser/i18n/zh-tw/tools.d.ts +3 -0
- package/lib/browser/i18n/zh-tw/tools.js +88 -0
- package/lib/browser/offline/device-values.d.ts +4 -0
- package/lib/browser/offline/device-values.js +10 -0
- package/lib/browser/pwa/page-build.d.ts +16 -0
- package/lib/browser/pwa/page-build.js +48 -0
- package/lib/browser/settings/settings-protocol.d.ts +2 -0
- package/lib/browser/settings/settings-protocol.js +2 -0
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +3 -0
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +6 -0
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation-column.js +17 -0
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +5 -0
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +0 -7
- package/lib/browser/style/video-call.d.ts +1 -1
- package/lib/browser/style/video-call.js +15 -4
- package/lib/browser/util/call-transcript.d.ts +17 -0
- package/lib/browser/util/call-transcript.js +113 -0
- package/lib/browser/util/process.d.ts +6 -0
- package/lib/browser/util/process.js +17 -4
- package/lib/browser/video-call/call-people.d.ts +22 -0
- package/lib/browser/video-call/call-people.js +32 -0
- package/lib/browser/video-call/clip-plan.d.ts +11 -2
- package/lib/browser/video-call/clip-plan.js +19 -3
- package/lib/browser/video-call/face-camera.d.ts +94 -0
- package/lib/browser/video-call/face-camera.js +197 -0
- package/lib/browser/video-call/face-files.d.ts +43 -5
- package/lib/browser/video-call/face-files.js +73 -18
- package/lib/browser/video-call/face-moves.d.ts +69 -0
- package/lib/browser/video-call/face-moves.js +184 -0
- package/lib/browser/video-call/face-stage.d.ts +140 -0
- package/lib/browser/video-call/face-stage.js +223 -0
- package/lib/browser/video-call/mouth-layer.d.ts +82 -0
- package/lib/browser/video-call/mouth-layer.js +245 -0
- package/lib/browser/video-call/video-call-view.js +44 -4
- package/lib/browser/video-call/video-face.d.ts +11 -5
- package/lib/browser/video-call/video-face.js +302 -328
- package/lib/browser/workbench.d.ts +8 -0
- package/lib/browser/workbench.js +36 -0
- package/package.json +7 -7
- package/public/faces/README.md +17 -4
- package/public/faces/blonde/clap.mp4 +0 -0
- package/public/faces/blonde/dance.mp4 +0 -0
- package/public/faces/blonde/face.jpg +0 -0
- package/public/faces/blonde/happy.mp4 +0 -0
- package/public/faces/blonde/heart.mp4 +0 -0
- package/public/faces/blonde/idle-1.mp4 +0 -0
- package/public/faces/blonde/idle-2.mp4 +0 -0
- package/public/faces/blonde/idle-3.mp4 +0 -0
- package/public/faces/blonde/laugh.mp4 +0 -0
- package/public/faces/blonde/listening.mp4 +0 -0
- package/public/faces/blonde/poster.jpg +0 -0
- package/public/faces/blonde/shy.mp4 +0 -0
- package/public/faces/blonde/sorry.mp4 +0 -0
- package/public/faces/blonde/stretch.mp4 +0 -0
- package/public/faces/blonde/surprised.mp4 +0 -0
- package/public/faces/blonde/talk-1.mp4 +0 -0
- package/public/faces/blonde/talk-2.mp4 +0 -0
- package/public/faces/blonde/think-2.mp4 +0 -0
- package/public/faces/blonde/thinking.mp4 +0 -0
- package/public/faces/blonde/wave.mp4 +0 -0
- package/public/faces/dance.mp4 +0 -0
- package/public/faces/face.jpg +0 -0
- package/public/faces/framing.json +1 -0
- package/public/faces/lips.json +1 -1
- package/public/faces/stretch.mp4 +0 -0
- package/esm/browser/video-call/face-clips.d.ts +0 -33
- package/esm/browser/video-call/face-clips.js +0 -93
- package/lib/browser/video-call/face-clips.d.ts +0 -34
- package/lib/browser/video-call/face-clips.js +0 -96
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ChevronRight, FoldVertical } from 'lucide-react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { CustomMessage, ExtensionBoundary, MessageRenderers, SessionAvatars } from '../extension/extension-view.js';
|
|
3
|
+
import { CallGroup, CustomMessage, ExtensionBoundary, MessageRenderers, SessionAvatars } from '../extension/extension-view.js';
|
|
4
4
|
import { useT } from '../i18n/use-t.js';
|
|
5
5
|
import { CodeAnswer } from '../markdown/code-renderers.js';
|
|
6
|
+
import { CallTranscript } from '../util/call-transcript.js';
|
|
6
7
|
import { MessageUtil } from '../util/message.js';
|
|
7
8
|
import { FreshRows, ProcessUtil } from '../util/process.js';
|
|
8
9
|
import { ProgressUtil } from '../util/progress.js';
|
|
@@ -43,11 +44,14 @@ export function quiet(item) {
|
|
|
43
44
|
export function endsInSteps(item) {
|
|
44
45
|
return (item === null || item === void 0 ? void 0 : item.kind) === 'turn' && item.steps.length > 0 && !item.reply.length;
|
|
45
46
|
}
|
|
46
|
-
function Turn({ item, tools, mood, status, latest, unsure, }) {
|
|
47
|
+
function Turn({ item, tools, mood, status, latest, unsure, spoken, }) {
|
|
47
48
|
const compacted = ProcessUtil.compaction(item);
|
|
48
49
|
if (compacted !== undefined) {
|
|
49
50
|
return React.createElement(CompactionBreak, { summary: compacted, tokens: MessageUtil.usage(item.messages).input });
|
|
50
51
|
}
|
|
52
|
+
if (spoken) {
|
|
53
|
+
return React.createElement(SpokenTurn, { item: item, tools: tools, mood: mood, status: status });
|
|
54
|
+
}
|
|
51
55
|
return React.createElement(WorkTurn, { item: item, tools: tools, mood: mood, status: status, latest: latest, unsure: unsure });
|
|
52
56
|
}
|
|
53
57
|
/** `unsure`: the conversation shows as this device kept it, before it is the session's of now; how the turn ended may be over. */
|
|
@@ -76,6 +80,32 @@ function WorkTurn({ item, tools, mood, status, latest, unsure, }) {
|
|
|
76
80
|
!item.active && React.createElement(TurnFooter, { messages: item.messages, last: item.last, reply: reply, session: session, latest: latest }),
|
|
77
81
|
menu));
|
|
78
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* What Ta said in a call, as a messenger shows it (CallTranscript): its face beside its words, what it did on the way
|
|
85
|
+
* folded above them. A turn the user cut short says nothing of it: they spoke, as one does on the phone; one that failed
|
|
86
|
+
* says so.
|
|
87
|
+
*/
|
|
88
|
+
function SpokenTurn({ item, tools, mood, status }) {
|
|
89
|
+
var _a;
|
|
90
|
+
const t = useT();
|
|
91
|
+
const session = React.useContext(ConversationSession);
|
|
92
|
+
const reply = item.reply.join('\n\n').trim();
|
|
93
|
+
const { errorMessage } = ((_a = item.last) !== null && _a !== void 0 ? _a : {});
|
|
94
|
+
const [menu, onContextMenu] = useMessageMenu({
|
|
95
|
+
kind: 'turn',
|
|
96
|
+
last: item.active ? undefined : item.last,
|
|
97
|
+
reply: item.active ? '' : reply,
|
|
98
|
+
session,
|
|
99
|
+
messages: item.messages,
|
|
100
|
+
});
|
|
101
|
+
return (React.createElement("div", { className: `ta-message ta-assistant ta-turn-spoken ${item.active ? 'ta-turn-live' : ''}`, onContextMenu: onContextMenu },
|
|
102
|
+
React.createElement(TurnAvatar, { mood: mood }),
|
|
103
|
+
React.createElement("div", { className: "ta-spoken-body" },
|
|
104
|
+
(item.steps.length > 0 || status) && (React.createElement(Process, { steps: item.steps, active: item.active, results: MessageUtil.results(item.messages), tools: tools, status: status })),
|
|
105
|
+
item.reply.map((text, index) => (React.createElement(Markdown, { key: index, text: text, streaming: item.active && index === item.reply.length - 1 }))),
|
|
106
|
+
!item.active && MessageUtil.stopReason(item.last) === 'error' && (React.createElement(Callout, { level: "error" }, (errorMessage === null || errorMessage === void 0 ? void 0 : errorMessage.trim()) || t('ta.message.failedUnknown')))),
|
|
107
|
+
menu));
|
|
108
|
+
}
|
|
79
109
|
/** How long a turn that just ended without a reply waits before it says so: an agent that goes on by itself does within it. */
|
|
80
110
|
const HOLD_MS = 8000;
|
|
81
111
|
/**
|
|
@@ -170,9 +200,10 @@ function Message({ item }) {
|
|
|
170
200
|
* One item of the conversation. The store replaces only the message that changed, so an item draws
|
|
171
201
|
* again only when one of its messages did, or, while ta is at it, when a tool run did.
|
|
172
202
|
*/
|
|
173
|
-
const ThreadRow = React.memo(function ThreadRow({ item, tools, mood, status, latest, unsure, }) {
|
|
174
|
-
return item.kind === 'turn' ? React.createElement(Turn, { item: item, tools: tools, mood: mood, status: status, latest: latest, unsure: unsure }) : React.createElement(Message, { item: item });
|
|
203
|
+
const ThreadRow = React.memo(function ThreadRow({ item, tools, mood, status, latest, unsure, spoken, }) {
|
|
204
|
+
return item.kind === 'turn' ? (React.createElement(Turn, { item: item, tools: tools, mood: mood, status: status, latest: latest, unsure: unsure, spoken: spoken })) : (React.createElement(Message, { item: item }));
|
|
175
205
|
}, (previous, next) => previous.mood === next.mood &&
|
|
206
|
+
previous.spoken === next.spoken &&
|
|
176
207
|
previous.unsure === next.unsure &&
|
|
177
208
|
previous.status === next.status &&
|
|
178
209
|
previous.latest === next.latest &&
|
|
@@ -235,7 +266,14 @@ export function useThreadRows(items, rows) {
|
|
|
235
266
|
/** The conversation; tool results show with the calls they answer. `rows`: only its latest rows are drawn, more as asked. */
|
|
236
267
|
export function MessageList({ state, outbox, rows }) {
|
|
237
268
|
const renderers = React.useContext(MessageRenderers);
|
|
238
|
-
const
|
|
269
|
+
const session = React.useContext(ConversationSession);
|
|
270
|
+
const callGroup = React.useContext(CallGroup);
|
|
271
|
+
// A conversation a call was answered in shows as the record of the call.
|
|
272
|
+
const spoken = !!(session === null || session === void 0 ? void 0 : session.group) && session.group === callGroup;
|
|
273
|
+
const items = React.useMemo(() => {
|
|
274
|
+
const all = ProcessUtil.items(state.messages, state.working, state.start, renderers, state.head);
|
|
275
|
+
return spoken ? CallTranscript.items(all) : all;
|
|
276
|
+
}, [state.messages, state.working, state.start, renderers, state.head, spoken]);
|
|
239
277
|
const breaks = React.useMemo(() => ProcessUtil.timeBreaks(ProcessUtil.starts(items), index => ProcessUtil.shown(items[index], renderers)), [items, renderers]);
|
|
240
278
|
const models = React.useMemo(() => ProcessUtil.modelBreaks(items), [items]);
|
|
241
279
|
// A turn's cards know what the user said after it: a choice they asked for is made.
|
|
@@ -255,11 +293,13 @@ export function MessageList({ state, outbox, rows }) {
|
|
|
255
293
|
const status = state.working || state.compacting ? React.createElement(RunStatus, { state: state }) : undefined;
|
|
256
294
|
const onHead = status && quiet(last);
|
|
257
295
|
return (React.createElement(Outbox.Provider, { value: sent },
|
|
258
|
-
items.map((item, index) => index < shown.from ? null : (React.createElement("div", { key: item.key, "data-row": item.key, className: shown.className(index, item.kind === 'message' && item.message.role === 'user' && ASK_CLASS
|
|
296
|
+
items.map((item, index) => index < shown.from ? null : (React.createElement("div", { key: item.key, "data-row": item.key, className: shown.className(index, [spoken && 'ta-spoken', item.kind === 'message' && item.message.role === 'user' && ASK_CLASS]
|
|
297
|
+
.filter(Boolean)
|
|
298
|
+
.join(' ')) },
|
|
259
299
|
breaks[index] !== undefined && React.createElement(TimeBreak, { timestamp: breaks[index] }),
|
|
260
300
|
models[index] && React.createElement(ModelBreak, { model: models[index] }),
|
|
261
301
|
React.createElement(CodeAnswer.Provider, { value: answers[index] },
|
|
262
|
-
React.createElement(ThreadRow, { item: item, tools: state.tools, mood: item.kind === 'turn' && !(unsure && index === lastTurn) ? ProcessUtil.mood(item, index === lastTurn, waiting) : 'idle', status: onHead && item === last ? status : undefined, latest: index === lastTurn, unsure: unsure && index === lastTurn }))))),
|
|
302
|
+
React.createElement(ThreadRow, { item: item, tools: state.tools, mood: item.kind === 'turn' && !(unsure && index === lastTurn) ? ProcessUtil.mood(item, index === lastTurn, waiting) : 'idle', status: onHead && item === last ? status : undefined, latest: index === lastTurn, unsure: unsure && index === lastTurn, spoken: spoken }))))),
|
|
263
303
|
status && !onHead && React.createElement("div", { className: `ta-run-line ${endsInSteps(last) ? 'ta-run-steps' : ''}` }, status)));
|
|
264
304
|
}
|
|
265
305
|
//# sourceMappingURL=message-list.js.map
|
|
@@ -21,6 +21,17 @@ const SummaryStep = React.memo(function SummaryStep({ text }) {
|
|
|
21
21
|
React.createElement(Icon, { icon: ChevronRight, size: 14, className: "ta-step-chevron" })),
|
|
22
22
|
open && React.createElement("div", { className: "ta-thinking-text" }, text)));
|
|
23
23
|
});
|
|
24
|
+
/** What it wrote of the pictures attached, for Ta to keep: one quiet line, which opens to a line for each picture. */
|
|
25
|
+
const PicturesStep = React.memo(function PicturesStep({ told }) {
|
|
26
|
+
const t = useT();
|
|
27
|
+
const [open, setOpen] = React.useState(false);
|
|
28
|
+
return (React.createElement("div", { className: "ta-step-summary ta-step-pictures" },
|
|
29
|
+
React.createElement("button", { type: "button", className: "ta-step-toggle", "aria-expanded": open, onClick: () => setOpen(!open) },
|
|
30
|
+
React.createElement("span", { className: "ta-status ta-status-thought" }),
|
|
31
|
+
React.createElement("span", { className: "ta-step-tag" }, t('ta.message.picturesSeen', { count: told.length })),
|
|
32
|
+
React.createElement(Icon, { icon: ChevronRight, size: 14, className: "ta-step-chevron" })),
|
|
33
|
+
open && (React.createElement("div", { className: "ta-thinking-text" }, told.map(([at, what]) => (React.createElement("div", { key: at }, t('ta.message.pictureSeen', { n: at, what }))))))));
|
|
34
|
+
});
|
|
24
35
|
/** A request that failed on the way, the work going on after it: one quiet line, which opens to the error. */
|
|
25
36
|
const ErrorStep = React.memo(function ErrorStep({ text }) {
|
|
26
37
|
const t = useT();
|
|
@@ -68,6 +79,8 @@ function Step({ step, results, tools, tagged, streaming, }) {
|
|
|
68
79
|
return React.createElement(TextStep, { text: step.text, streaming: streaming });
|
|
69
80
|
case 'summary':
|
|
70
81
|
return React.createElement(SummaryStep, { text: step.text });
|
|
82
|
+
case 'pictures':
|
|
83
|
+
return React.createElement(PicturesStep, { told: step.told });
|
|
71
84
|
case 'error':
|
|
72
85
|
return React.createElement(ErrorStep, { text: step.text });
|
|
73
86
|
case 'said':
|
|
@@ -47,7 +47,7 @@ export function arrangeViews(views, onOpen, setting, handheld, infoOf, kinds) {
|
|
|
47
47
|
return view => (arranged.nav.includes(view) ? 'navigation' : arranged.discover.includes(view) ? 'discover' : 'list');
|
|
48
48
|
}
|
|
49
49
|
/** The groups of Discover, in their order: each a card of its own. */
|
|
50
|
-
export const DISCOVER_GROUPS = ['people', 'work', 'share', 'more'];
|
|
50
|
+
export const DISCOVER_GROUPS = ['people', 'work', 'share', 'tools', 'play', 'more'];
|
|
51
51
|
/** The pages under Discover by group (WebView.group, `more` without one or with one it does not know), in the order of DISCOVER_GROUPS; empty ones left out. */
|
|
52
52
|
export function discoverGroups(pages) {
|
|
53
53
|
const of = (page) => (page.group && DISCOVER_GROUPS.includes(page.group) ? page.group : 'more');
|
|
@@ -20,6 +20,7 @@ import { ThumbnailUtil } from '../util/thumbnail.js';
|
|
|
20
20
|
import { Voice } from '../util/voice.js';
|
|
21
21
|
import { TaWorkbench } from '../workbench-protocol.js';
|
|
22
22
|
import { ChatAskUtil, LET_GO_ASKS } from './chat-asks.js';
|
|
23
|
+
import { ChatTagLabel, useChatTag } from './chat-tag.js';
|
|
23
24
|
import { Composer } from './composer.js';
|
|
24
25
|
import { useComposerAddons } from './composer-addons.js';
|
|
25
26
|
import { ComposerTarget } from './composer-target.js';
|
|
@@ -215,6 +216,8 @@ export function SessionView({ store, server, workspace, info, onClosed, onActivi
|
|
|
215
216
|
const title = (info === null || info === void 0 ? void 0 : info.sessionName) || (info ? MessageUtil.basename(info.cwd) : t('ta.session.title'));
|
|
216
217
|
const conversation = React.useMemo(() => ({ sessionId: store.sessionId, sessionFile: info === null || info === void 0 ? void 0 : info.sessionFile, cwd: info === null || info === void 0 ? void 0 : info.cwd, kind: 'chat', group: info === null || info === void 0 ? void 0 : info.group, title }), [store.sessionId, info === null || info === void 0 ? void 0 : info.sessionFile, info === null || info === void 0 ? void 0 : info.cwd, info === null || info === void 0 ? void 0 : info.group, title]);
|
|
217
218
|
const addons = useComposerAddons(conversation);
|
|
219
|
+
// What an extension says it is, after its name on top (Work, of a directory marked so).
|
|
220
|
+
const chatTag = useChatTag(info ? { sessionFile: info.sessionFile, cwd: info.cwd, ...(info.group ? { group: info.group } : {}) } : undefined);
|
|
218
221
|
// Finding words in it (ConversationFind): 0 while it does not show, counted up each time it is asked for.
|
|
219
222
|
const [finding, setFinding] = React.useState(0);
|
|
220
223
|
const closeFind = React.useCallback(() => setFinding(0), []);
|
|
@@ -341,7 +344,9 @@ export function SessionView({ store, server, workspace, info, onClosed, onActivi
|
|
|
341
344
|
!compact && (React.createElement("header", { className: "ta-session-header" },
|
|
342
345
|
leading,
|
|
343
346
|
React.createElement("div", { className: "ta-session-title" },
|
|
344
|
-
React.createElement("span", { className: "ta-title" },
|
|
347
|
+
chatTag ? (React.createElement("span", { className: "ta-title-line" },
|
|
348
|
+
React.createElement("span", { className: "ta-title" }, title),
|
|
349
|
+
React.createElement(ChatTagLabel, { tag: chatTag }))) : (React.createElement("span", { className: "ta-title" }, title)),
|
|
345
350
|
info && (React.createElement("span", { className: "ta-muted ta-path", title: info.cwd }, MessageUtil.shortPath(info.cwd)))),
|
|
346
351
|
React.createElement(PeopleFaces, { people: viewing, size: 24, label: t('ta.presence.viewing') }),
|
|
347
352
|
trailing)),
|
|
@@ -27,7 +27,10 @@ export const GROUP_ICONS = { model: Box, conversation: MessagesSquare, context:
|
|
|
27
27
|
/** The parts of the settings, in their order: by what the user looks for, not where a setting is kept. */
|
|
28
28
|
export const SETTINGS_GROUPS = [
|
|
29
29
|
{ id: 'general', title: 'ta.settings.general' },
|
|
30
|
+
{ id: 'chats', title: 'ta.settings.part.chats' },
|
|
30
31
|
{ id: 'ta', title: 'ta.settings.agent' },
|
|
32
|
+
{ id: 'initiative', title: 'ta.settings.part.initiative' },
|
|
33
|
+
{ id: 'voice', title: 'ta.settings.part.voice' },
|
|
31
34
|
{ id: 'devices', title: 'ta.settings.devices' },
|
|
32
35
|
{ id: 'privacy', title: 'ta.settings.privacy' },
|
|
33
36
|
{ id: 'extensions', title: 'ta.packages' },
|
|
@@ -63,6 +63,19 @@ export declare namespace SettingsViewUtil {
|
|
|
63
63
|
}, P extends {
|
|
64
64
|
sections: S[];
|
|
65
65
|
}>(parts: P[], query: string): P[];
|
|
66
|
+
/**
|
|
67
|
+
* The sections in their parts, in the order of `groups`: a section without a group in the first, those of a part by
|
|
68
|
+
* `order` (default 0), in the order given for the same; parts without a section left out.
|
|
69
|
+
*/
|
|
70
|
+
function parts<S extends {
|
|
71
|
+
group?: string;
|
|
72
|
+
order?: number;
|
|
73
|
+
}>(sections: readonly S[], groups: readonly {
|
|
74
|
+
id: string;
|
|
75
|
+
}[]): {
|
|
76
|
+
id: string;
|
|
77
|
+
sections: S[];
|
|
78
|
+
}[];
|
|
66
79
|
/** Where `scroller` puts `element` at its top, below its scroll padding; no further than it scrolls. */
|
|
67
80
|
function scrollTop(scroller: HTMLElement, element: HTMLElement): number;
|
|
68
81
|
}
|
|
@@ -70,6 +70,25 @@ export var SettingsViewUtil;
|
|
|
70
70
|
.filter(part => part.sections.length > 0);
|
|
71
71
|
}
|
|
72
72
|
SettingsViewUtil.filter = filter;
|
|
73
|
+
/**
|
|
74
|
+
* The sections in their parts, in the order of `groups`: a section without a group in the first, those of a part by
|
|
75
|
+
* `order` (default 0), in the order given for the same; parts without a section left out.
|
|
76
|
+
*/
|
|
77
|
+
function parts(sections, groups) {
|
|
78
|
+
var _a;
|
|
79
|
+
const first = (_a = groups[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
80
|
+
return groups
|
|
81
|
+
.map(({ id }) => ({
|
|
82
|
+
id,
|
|
83
|
+
sections: sections
|
|
84
|
+
.filter(entry => { var _a; return ((_a = entry.group) !== null && _a !== void 0 ? _a : first) === id; })
|
|
85
|
+
.map((entry, index) => ({ entry, index }))
|
|
86
|
+
.sort((a, b) => { var _a, _b; return ((_a = a.entry.order) !== null && _a !== void 0 ? _a : 0) - ((_b = b.entry.order) !== null && _b !== void 0 ? _b : 0) || a.index - b.index; })
|
|
87
|
+
.map(({ entry }) => entry),
|
|
88
|
+
}))
|
|
89
|
+
.filter(part => part.sections.length > 0);
|
|
90
|
+
}
|
|
91
|
+
SettingsViewUtil.parts = parts;
|
|
73
92
|
/** Where `scroller` puts `element` at its top, below its scroll padding; no further than it scrolls. */
|
|
74
93
|
function scrollTop(scroller, element) {
|
|
75
94
|
const padding = Number.parseFloat(getComputedStyle(scroller).scrollPaddingTop) || 0;
|
|
@@ -4,4 +4,4 @@ import type { SectionEntry, SettingsDialog } from './settings-parts.js';
|
|
|
4
4
|
* those built in, those of extensions where they ask, the computers and services Ta reaches, who may come in, the
|
|
5
5
|
* keys, and what is about Ta and this computer.
|
|
6
6
|
*/
|
|
7
|
-
export declare function useMoreSections(
|
|
7
|
+
export declare function useMoreSections(onDialog: (dialog: SettingsDialog) => void): SectionEntry[];
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { Blocks, Cloud, FolderOpen, Info, Keyboard,
|
|
1
|
+
import { Blocks, Cloud, FolderOpen, Info, Keyboard, Puzzle, RefreshCw, RotateCw, Server, ShieldCheck, Trash2, Waypoints } from 'lucide-react';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useDevice } from '../device/device.js';
|
|
4
4
|
import { ExtensionBoundary } from '../extension/extension-view.js';
|
|
5
5
|
import { WebLabelUtil } from '../extension/web-extension-protocol.js';
|
|
6
6
|
import { useNotices, useSettings, useWebExtensions, useWorkbench } from '../hooks.js';
|
|
7
7
|
import { useLanguage, useT } from '../i18n/use-t.js';
|
|
8
|
-
import { WorkbenchUtil } from '../workbench-util.js';
|
|
9
8
|
import { AccessSettings, useAccess } from './access-view.js';
|
|
10
9
|
import { BusyMark } from './busy.js';
|
|
11
10
|
import { EnvironmentSettings, useGateway } from './environment-view.js';
|
|
@@ -23,12 +22,12 @@ import { SignInSetupSettings, useSignInConfig } from './sign-in-setup.js';
|
|
|
23
22
|
* those built in, those of extensions where they ask, the computers and services Ta reaches, who may come in, the
|
|
24
23
|
* keys, and what is about Ta and this computer.
|
|
25
24
|
*/
|
|
26
|
-
export function useMoreSections(
|
|
25
|
+
export function useMoreSections(onDialog) {
|
|
27
26
|
var _a, _b;
|
|
28
27
|
const t = useT();
|
|
29
28
|
const language = useLanguage();
|
|
30
29
|
const [{ settings }, store] = useSettings();
|
|
31
|
-
const [workbench
|
|
30
|
+
const [workbench] = useWorkbench();
|
|
32
31
|
const [{ extensions, settingsSections }, host] = useWebExtensions();
|
|
33
32
|
const packageList = usePackages();
|
|
34
33
|
const builtinPackages = packageList.packages.filter(pkg => pkg.origin === 'builtin');
|
|
@@ -37,10 +36,8 @@ export function useMoreSections(onClose, onDialog) {
|
|
|
37
36
|
const signInConfig = useSignInConfig();
|
|
38
37
|
const gateway = useGateway();
|
|
39
38
|
const restartTa = useRestartTa();
|
|
40
|
-
//
|
|
41
|
-
// that pairs phones, and signs out at the foot of Me.
|
|
39
|
+
// A finger has no keys to learn.
|
|
42
40
|
const touch = useDevice(device => device.touch);
|
|
43
|
-
const handheld = useDevice(device => device.handheld);
|
|
44
41
|
// What runs, one thing at a time: its control turns (Switch, IconButton busy), the others wait.
|
|
45
42
|
const [busy, setBusy] = React.useState();
|
|
46
43
|
const run = (key, action, done) => {
|
|
@@ -185,14 +182,36 @@ export function useMoreSections(onClose, onDialog) {
|
|
|
185
182
|
id: 'shortcuts',
|
|
186
183
|
title: t('ta.settings.shortcuts'),
|
|
187
184
|
icon: Keyboard,
|
|
185
|
+
// Last of General, with About, after those of extensions there.
|
|
186
|
+
order: 900,
|
|
188
187
|
rows: SHORTCUTS.map(shortcut => row(`key:${shortcut.keys}`, [t(shortcut.label), shortcut.keys, t('ta.settings.shortcuts')], React.createElement(Row, { label: t(shortcut.label) },
|
|
189
188
|
React.createElement(Keys, { keys: shortcut.keys })))),
|
|
190
189
|
},
|
|
191
190
|
]),
|
|
191
|
+
// Where new chats open: how Ta works, beside its model and tools.
|
|
192
|
+
...(workbench.server
|
|
193
|
+
? [
|
|
194
|
+
{
|
|
195
|
+
id: 'directory',
|
|
196
|
+
title: t('ta.settings.cwd'),
|
|
197
|
+
icon: FolderOpen,
|
|
198
|
+
group: 'ta',
|
|
199
|
+
order: 50,
|
|
200
|
+
rows: [
|
|
201
|
+
row('cwd', [t('ta.settings.cwd'), workbench.server.cwd], React.createElement(Row, { label: t('ta.settings.cwd'), description: t('ta.settings.cwdDescription', { path: workbench.server.cwd }) },
|
|
202
|
+
React.createElement("button", { type: "button", className: "ta-button", onClick: () => onDialog('directory') },
|
|
203
|
+
React.createElement(Icon, { icon: FolderOpen, size: 15 }),
|
|
204
|
+
" ",
|
|
205
|
+
t('ta.settings.cwdChange')))),
|
|
206
|
+
],
|
|
207
|
+
},
|
|
208
|
+
]
|
|
209
|
+
: []),
|
|
192
210
|
{
|
|
193
211
|
id: 'about',
|
|
194
212
|
title: t('ta.settings.about'),
|
|
195
213
|
icon: Info,
|
|
214
|
+
order: 1000,
|
|
196
215
|
rows: workbench.server
|
|
197
216
|
? [
|
|
198
217
|
row('version', [t('ta.settings.version'), 'version'], React.createElement(Row, { label: t('ta.settings.version'), description: restartTa.update
|
|
@@ -209,37 +228,6 @@ export function useMoreSections(onClose, onDialog) {
|
|
|
209
228
|
]
|
|
210
229
|
: []),
|
|
211
230
|
row('settings-files', [t('ta.settings.files'), 'settings.json', 'models.json', 'JSON'], React.createElement(SettingsFilesRow, null)),
|
|
212
|
-
row('cwd', [t('ta.settings.cwd'), workbench.server.cwd], React.createElement(Row, { label: t('ta.settings.cwd'), description: t('ta.settings.cwdDescription', { path: workbench.server.cwd }) },
|
|
213
|
-
React.createElement("button", { type: "button", className: "ta-button", onClick: () => onDialog('directory') },
|
|
214
|
-
React.createElement(Icon, { icon: FolderOpen, size: 15 }),
|
|
215
|
-
" ",
|
|
216
|
-
t('ta.settings.cwdChange')))),
|
|
217
|
-
row('accounts', [t('ta.settings.accounts'), t('ta.settings.accountsDescription')], React.createElement(Row, { label: t('ta.settings.accounts'), description: t('ta.settings.accountsDescription') },
|
|
218
|
-
React.createElement("button", { type: "button", className: "ta-button", onClick: () => onDialog('accounts') },
|
|
219
|
-
React.createElement(Icon, { icon: KeyRound, size: 15 }),
|
|
220
|
-
" ",
|
|
221
|
-
t('ta.settings.manageAccounts')))),
|
|
222
|
-
...(WorkbenchUtil.isApp() || handheld
|
|
223
|
-
? []
|
|
224
|
-
: [
|
|
225
|
-
row('relay', [t('ta.settings.relay'), t('ta.settings.relayDescription')], React.createElement(Row, { label: t('ta.settings.relay'), description: t('ta.settings.relayDescription') },
|
|
226
|
-
React.createElement("button", { type: "button", className: "ta-button", onClick: () => onDialog('relay') },
|
|
227
|
-
React.createElement(Icon, { icon: Smartphone, size: 15 }),
|
|
228
|
-
" ",
|
|
229
|
-
t('ta.settings.manageAccounts')))),
|
|
230
|
-
]),
|
|
231
|
-
...(handheld
|
|
232
|
-
? []
|
|
233
|
-
: [
|
|
234
|
-
row('signOut', [t('ta.settings.signOut')], React.createElement(Row, { label: t('ta.settings.signOut') },
|
|
235
|
-
React.createElement("button", { type: "button", className: "ta-button ta-danger", onClick: () => {
|
|
236
|
-
onClose();
|
|
237
|
-
bench.signOut();
|
|
238
|
-
} },
|
|
239
|
-
React.createElement(Icon, { icon: LogOut, size: 15 }),
|
|
240
|
-
" ",
|
|
241
|
-
t('ta.settings.signOut')))),
|
|
242
|
-
]),
|
|
243
231
|
]
|
|
244
232
|
: [],
|
|
245
233
|
},
|
|
@@ -248,13 +236,14 @@ export function useMoreSections(onClose, onDialog) {
|
|
|
248
236
|
}
|
|
249
237
|
/** A section an extension added (WebExtensionAPI.registerSettings): its rows as Ta's, each control in a boundary of its own. */
|
|
250
238
|
function extensionSection({ id, section }) {
|
|
251
|
-
var _a;
|
|
239
|
+
var _a, _b;
|
|
252
240
|
const title = WebLabelUtil.text(section.title);
|
|
253
241
|
return {
|
|
254
242
|
id: `extension-${id.replace(/[^\w-]+/g, '-')}`,
|
|
255
243
|
title,
|
|
256
244
|
icon: (_a = section.icon) !== null && _a !== void 0 ? _a : Puzzle,
|
|
257
245
|
group: section.group && SETTINGS_GROUPS.some(group => group.id === section.group) ? section.group : 'extensions',
|
|
246
|
+
order: (_b = section.order) !== null && _b !== void 0 ? _b : 100,
|
|
258
247
|
rows: section.rows.map(item => {
|
|
259
248
|
const label = WebLabelUtil.text(item.label);
|
|
260
249
|
const description = item.description === undefined ? undefined : WebLabelUtil.text(item.description);
|
|
@@ -10,6 +10,8 @@ export interface SectionEntry {
|
|
|
10
10
|
rows: RowEntry[];
|
|
11
11
|
/** The part it is in; default `general`. */
|
|
12
12
|
group?: WebSettingsGroup;
|
|
13
|
+
/** Smaller first in its part, in the order given for the same; default 0, an extension's 100 (WebSettingsSection.order). */
|
|
14
|
+
order?: number;
|
|
13
15
|
/** A setting of pi's files, of the user or of the project: under the scope of its part (Part.lead). */
|
|
14
16
|
scoped?: boolean;
|
|
15
17
|
}
|
|
@@ -21,6 +23,6 @@ export interface Part {
|
|
|
21
23
|
lead?: React.ReactNode;
|
|
22
24
|
}
|
|
23
25
|
/** What a row of the settings opens over them. */
|
|
24
|
-
export type SettingsDialog = '
|
|
26
|
+
export type SettingsDialog = 'directory';
|
|
25
27
|
/** The sections of the page and of ta, by part, with their rows. */
|
|
26
|
-
export declare function useParts(scope: TaSettingsScope, onScope: (scope: TaSettingsScope) => void,
|
|
28
|
+
export declare function useParts(scope: TaSettingsScope, onScope: (scope: TaSettingsScope) => void, onDialog: (dialog: SettingsDialog) => void): Part[];
|
|
@@ -12,13 +12,13 @@ import { useNavigation } from './app-nav.js';
|
|
|
12
12
|
import { Loading } from './loading.js';
|
|
13
13
|
import { SettingsModelPicker } from './model-picker.js';
|
|
14
14
|
import { DIAGRAM_STYLE_CHOICES, FONT_SIZES, GROUP_ICONS, LANGUAGES, navigationRows, SETTINGS_GROUPS, THEMES } from './settings-choices.js';
|
|
15
|
-
import { ChoiceRow, Row, row, Segmented, Switch } from './settings-controls.js';
|
|
15
|
+
import { ChoiceRow, Row, row, Segmented, SettingsViewUtil, Switch } from './settings-controls.js';
|
|
16
16
|
import { useMoreSections } from './settings-more.js';
|
|
17
17
|
import { TrustedDomains } from './trusted-domains.js';
|
|
18
18
|
import { VoicePicker } from './voice-picker.js';
|
|
19
19
|
import { VoiceServices } from './voice-services.js';
|
|
20
20
|
/** The sections of the page and of ta, by part, with their rows. */
|
|
21
|
-
export function useParts(scope, onScope,
|
|
21
|
+
export function useParts(scope, onScope, onDialog) {
|
|
22
22
|
var _a;
|
|
23
23
|
const t = useT();
|
|
24
24
|
const [{ settings }, store] = useSettings();
|
|
@@ -27,7 +27,7 @@ export function useParts(scope, onScope, onClose, onDialog) {
|
|
|
27
27
|
const [{ cwd, views }] = useWebExtensions();
|
|
28
28
|
const navigation = useNavigation(views);
|
|
29
29
|
const agent = useAgentSettings(cwd !== null && cwd !== void 0 ? cwd : (_a = workbench.server) === null || _a === void 0 ? void 0 : _a.cwd);
|
|
30
|
-
const more = useMoreSections(
|
|
30
|
+
const more = useMoreSections(onDialog);
|
|
31
31
|
const handheld = useDevice(device => device.handheld);
|
|
32
32
|
const web = [
|
|
33
33
|
{
|
|
@@ -72,6 +72,7 @@ export function useParts(scope, onScope, onClose, onDialog) {
|
|
|
72
72
|
id: 'chats',
|
|
73
73
|
title: t('ta.settings.chats'),
|
|
74
74
|
icon: List,
|
|
75
|
+
group: 'chats',
|
|
75
76
|
rows: [
|
|
76
77
|
row('chat-fold', [t('ta.settings.chatFold'), t('ta.settings.chatFoldHint')], React.createElement(Row, { label: t('ta.settings.chatFold'), description: t('ta.settings.chatFoldHint'), stacked: true },
|
|
77
78
|
React.createElement(Segmented, { label: t('ta.settings.chatFold'), value: String(settings.chatFoldDays), choices: CHAT_FOLD_CHOICES.map(days => ({
|
|
@@ -91,6 +92,9 @@ export function useParts(scope, onScope, onClose, onDialog) {
|
|
|
91
92
|
id: 'links',
|
|
92
93
|
title: t('ta.settings.links'),
|
|
93
94
|
icon: Link2,
|
|
95
|
+
group: 'chats',
|
|
96
|
+
// After the notices and who answers others, before what is kept.
|
|
97
|
+
order: 30,
|
|
94
98
|
rows: [
|
|
95
99
|
row('trusted-domains', [t('ta.settings.trustedDomains'), t('ta.settings.trustedDomainsHint'), ...settings.trustedDomains], React.createElement(TrustedDomains, null)),
|
|
96
100
|
],
|
|
@@ -120,6 +124,7 @@ export function useParts(scope, onScope, onClose, onDialog) {
|
|
|
120
124
|
id: 'voice',
|
|
121
125
|
title: t('ta.settings.voice'),
|
|
122
126
|
icon: Volume2,
|
|
127
|
+
group: 'voice',
|
|
123
128
|
rows: [
|
|
124
129
|
row('speak', [t('ta.settings.speak'), t('ta.settings.speakHint')], React.createElement(Row, { label: t('ta.settings.speak'), description: t('ta.settings.speakHint') },
|
|
125
130
|
React.createElement(Switch, { label: t('ta.settings.speak'), checked: settings.speak, onChange: speak => store.update({ speak }) }))),
|
|
@@ -172,11 +177,11 @@ export function useParts(scope, onScope, onClose, onDialog) {
|
|
|
172
177
|
}); });
|
|
173
178
|
// Ta's scoped sections first in its part, under their scope; each part's own sections before those of extensions.
|
|
174
179
|
const sections = [...web.filter(entry => entry.group !== 'ta'), ...ta, ...web.filter(entry => entry.group === 'ta'), ...more];
|
|
175
|
-
return SETTINGS_GROUPS.map(
|
|
176
|
-
id
|
|
177
|
-
title: t(group.title),
|
|
178
|
-
sections:
|
|
179
|
-
...(
|
|
180
|
-
})
|
|
180
|
+
return SettingsViewUtil.parts(sections, SETTINGS_GROUPS).map(({ id, sections: own }) => { var _a; var _b; return ({
|
|
181
|
+
id,
|
|
182
|
+
title: t((_b = (_a = SETTINGS_GROUPS.find(group => group.id === id)) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : 'ta.settings.general'),
|
|
183
|
+
sections: own,
|
|
184
|
+
...(id === 'ta' ? { lead } : {}),
|
|
185
|
+
}); });
|
|
181
186
|
}
|
|
182
187
|
//# sourceMappingURL=settings-parts.js.map
|
|
@@ -4,13 +4,11 @@ import { useDevice } from '../device/device.js';
|
|
|
4
4
|
import { useT } from '../i18n/use-t.js';
|
|
5
5
|
import { ScreenUtil } from '../screen/screen-protocol.js';
|
|
6
6
|
import { useScreenPart } from '../screen/use-screen-part.js';
|
|
7
|
-
import { AuthDialog } from './auth-view.js';
|
|
8
7
|
import { EmptyState } from './empty-state.js';
|
|
9
8
|
import { Icon, IconButton } from './icon.js';
|
|
10
9
|
import { ListGroup, ListRow } from './list-rows.js';
|
|
11
10
|
import { Loading } from './loading.js';
|
|
12
11
|
import { PhoneStack } from './phone-shell.js';
|
|
13
|
-
import { RelayDialog } from './relay-view.js';
|
|
14
12
|
import { SettingsViewUtil } from './settings-controls.js';
|
|
15
13
|
import { useParts } from './settings-parts.js';
|
|
16
14
|
import { WorkingDirectoryPicker } from './working-directory.js';
|
|
@@ -28,7 +26,7 @@ export function SettingsView({ section, onClose, onMenu, onBack }) {
|
|
|
28
26
|
const [scope, setScope] = React.useState('user');
|
|
29
27
|
const [dialog, setDialog] = React.useState();
|
|
30
28
|
const closeDialog = React.useCallback(() => setDialog(undefined), []);
|
|
31
|
-
const parts = useParts(scope, setScope,
|
|
29
|
+
const parts = useParts(scope, setScope, setDialog);
|
|
32
30
|
// What an agent reads of the settings and where it goes in them (docs/design/ta-app-use.md 3); the rows are read as they show.
|
|
33
31
|
useScreenPart({
|
|
34
32
|
id: 'settings',
|
|
@@ -67,9 +65,7 @@ export function SettingsView({ section, onClose, onMenu, onBack }) {
|
|
|
67
65
|
const props = { parts, query, search, section };
|
|
68
66
|
return (React.createElement("section", { className: "ta-settings-page", "aria-label": t('ta.settings'), ...ScreenUtil.part('settings') },
|
|
69
67
|
handheld ? React.createElement(PhoneSettings, { ...props, onBack: onBack !== null && onBack !== void 0 ? onBack : onClose }) : React.createElement(WideSettings, { ...props, onClose: onClose, onMenu: onMenu, onBack: onBack }),
|
|
70
|
-
dialog === '
|
|
71
|
-
dialog === 'directory' && React.createElement(WorkingDirectoryPicker, { onClose: closeDialog }),
|
|
72
|
-
dialog === 'relay' && React.createElement(RelayDialog, { onClose: closeDialog })));
|
|
68
|
+
dialog === 'directory' && React.createElement(WorkingDirectoryPicker, { onClose: closeDialog })));
|
|
73
69
|
}
|
|
74
70
|
/** The rows of a section, in a card. */
|
|
75
71
|
function SectionRows({ entry }) {
|
|
@@ -19,4 +19,4 @@ export interface WebComposerHostProps extends WebComposerProps {
|
|
|
19
19
|
* The message box as web extensions get it (`pi.ui.Composer`): text, and pictures when it takes them (shrunk within
|
|
20
20
|
* the limits given), `@` for the names they give; a failure is a notice of the page.
|
|
21
21
|
*/
|
|
22
|
-
export declare function WebComposer({ notices, placeholder, onSend, images, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }: WebComposerHostProps): React.JSX.Element;
|
|
22
|
+
export declare function WebComposer({ notices, placeholder, onSend, images, emoji, autoFocus, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }: WebComposerHostProps): React.JSX.Element;
|
|
@@ -10,7 +10,7 @@ import { DirectoryButton } from './folder-picker.js';
|
|
|
10
10
|
* The message box as web extensions get it (`pi.ui.Composer`): text, and pictures when it takes them (shrunk within
|
|
11
11
|
* the limits given), `@` for the names they give; a failure is a notice of the page.
|
|
12
12
|
*/
|
|
13
|
-
export function WebComposer({ notices, placeholder, onSend, images, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }) {
|
|
13
|
+
export function WebComposer({ notices, placeholder, onSend, images, emoji, autoFocus, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }) {
|
|
14
14
|
const t = useT();
|
|
15
15
|
const language = useLanguage();
|
|
16
16
|
const [query, setQuery] = React.useState();
|
|
@@ -19,7 +19,7 @@ export function WebComposer({ notices, placeholder, onSend, images, mentions, me
|
|
|
19
19
|
return (React.createElement(ComposerBox, { placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t('ta.composer.label'), onSend: async (text, attached) => {
|
|
20
20
|
const limits = typeof images === 'object' ? images : undefined;
|
|
21
21
|
await onSend(text, limits ? await Promise.all(attached.map(image => ImageShrink.shrink(image, limits))) : attached);
|
|
22
|
-
}, images: !!images, commands: listed, onMentionQuery: mentions ? setQuery : undefined, mentions: mentions && query !== undefined
|
|
22
|
+
}, images: !!images, emoji: emoji, autoFocus: autoFocus, commands: listed, onMentionQuery: mentions ? setQuery : undefined, mentions: mentions && query !== undefined
|
|
23
23
|
? {
|
|
24
24
|
items: ComposerUtil.commands(mentions, query).map(mention => ({
|
|
25
25
|
key: mention.name,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { WebFileSaved as FileSaveResult } from '../extension/web-api-desktop.js';
|
|
2
|
+
/** What the page asks the Ta app: TaSave.swift of apps/ta-mobile on iOS, MainActivity.java on Android. */
|
|
3
|
+
export interface FileSaveMessage {
|
|
4
|
+
id: string;
|
|
5
|
+
action: 'begin' | 'chunk' | 'end';
|
|
6
|
+
/** `begin`: the name of the file, its type. */
|
|
7
|
+
name?: string;
|
|
8
|
+
type?: string;
|
|
9
|
+
/** `chunk`: the next bytes, in base64. */
|
|
10
|
+
data?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Files kept on a phone as its system keeps them, where a browser's download does nothing (the web view of the Ta
|
|
14
|
+
* app has none): on iOS pictures and videos go to the album, other files to Files where the user picks; on Android
|
|
15
|
+
* everything goes to Downloads. The bytes go to the app in pieces, which it writes to a file of its own before it
|
|
16
|
+
* keeps it. Elsewhere (a browser, Ta Desktop) there is none: the page downloads as browsers do.
|
|
17
|
+
*/
|
|
18
|
+
export declare namespace FileSave {
|
|
19
|
+
const EVENT = "ta-save";
|
|
20
|
+
/** The bytes of one message: a multiple of 3, so that each piece is base64 of its own, without padding inside. */
|
|
21
|
+
const CHUNK_BYTES: number;
|
|
22
|
+
/** Whether the device keeps files itself here: in the Ta app on iOS and Android. */
|
|
23
|
+
function available(): boolean;
|
|
24
|
+
/** Base64 of bytes, a piece at a time: `String.fromCharCode` takes only so many arguments. */
|
|
25
|
+
function base64(bytes: Uint8Array): string;
|
|
26
|
+
/**
|
|
27
|
+
* Keeps `file` on the device as `name`. Not timed out: the user takes the time they need in Files. Rejects when
|
|
28
|
+
* the app could not write or keep it; resolves `cancelled` in a browser.
|
|
29
|
+
*/
|
|
30
|
+
function save(file: Blob, name: string): Promise<FileSaveResult>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Files kept on a phone as its system keeps them, where a browser's download does nothing (the web view of the Ta
|
|
3
|
+
* app has none): on iOS pictures and videos go to the album, other files to Files where the user picks; on Android
|
|
4
|
+
* everything goes to Downloads. The bytes go to the app in pieces, which it writes to a file of its own before it
|
|
5
|
+
* keeps it. Elsewhere (a browser, Ta Desktop) there is none: the page downloads as browsers do.
|
|
6
|
+
*/
|
|
7
|
+
export var FileSave;
|
|
8
|
+
(function (FileSave) {
|
|
9
|
+
FileSave.EVENT = 'ta-save';
|
|
10
|
+
/** The bytes of one message: a multiple of 3, so that each piece is base64 of its own, without padding inside. */
|
|
11
|
+
FileSave.CHUNK_BYTES = 3 * 256 * 1024;
|
|
12
|
+
let next = 0;
|
|
13
|
+
function native() {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const scope = globalThis;
|
|
16
|
+
const ios = (_b = (_a = scope.webkit) === null || _a === void 0 ? void 0 : _a.messageHandlers) === null || _b === void 0 ? void 0 : _b.taSave;
|
|
17
|
+
if (ios) {
|
|
18
|
+
return { post: message => ios.postMessage(message) };
|
|
19
|
+
}
|
|
20
|
+
const android = scope.taSaveAndroid;
|
|
21
|
+
return android ? { post: message => android.post(JSON.stringify(message)) } : undefined;
|
|
22
|
+
}
|
|
23
|
+
/** Whether the device keeps files itself here: in the Ta app on iOS and Android. */
|
|
24
|
+
function available() {
|
|
25
|
+
return native() !== undefined;
|
|
26
|
+
}
|
|
27
|
+
FileSave.available = available;
|
|
28
|
+
/** Base64 of bytes, a piece at a time: `String.fromCharCode` takes only so many arguments. */
|
|
29
|
+
function base64(bytes) {
|
|
30
|
+
let text = '';
|
|
31
|
+
for (let start = 0; start < bytes.length; start += 0x8000) {
|
|
32
|
+
text += String.fromCharCode(...bytes.subarray(start, start + 0x8000));
|
|
33
|
+
}
|
|
34
|
+
return btoa(text);
|
|
35
|
+
}
|
|
36
|
+
FileSave.base64 = base64;
|
|
37
|
+
/**
|
|
38
|
+
* Keeps `file` on the device as `name`. Not timed out: the user takes the time they need in Files. Rejects when
|
|
39
|
+
* the app could not write or keep it; resolves `cancelled` in a browser.
|
|
40
|
+
*/
|
|
41
|
+
async function save(file, name) {
|
|
42
|
+
const app = native();
|
|
43
|
+
if (!app) {
|
|
44
|
+
return 'cancelled';
|
|
45
|
+
}
|
|
46
|
+
const id = `s${++next}`;
|
|
47
|
+
let onEvent = () => undefined;
|
|
48
|
+
const answer = new Promise((resolve, reject) => {
|
|
49
|
+
onEvent = (event) => {
|
|
50
|
+
const detail = event.detail;
|
|
51
|
+
if ((detail === null || detail === void 0 ? void 0 : detail.id) !== id) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
globalThis.removeEventListener(FileSave.EVENT, onEvent);
|
|
55
|
+
if (detail.result) {
|
|
56
|
+
resolve(detail.result);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
reject(new Error(detail.error || 'The file could not be saved'));
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
globalThis.addEventListener(FileSave.EVENT, onEvent);
|
|
63
|
+
});
|
|
64
|
+
try {
|
|
65
|
+
app.post({ id, action: 'begin', name, type: file.type });
|
|
66
|
+
for (let start = 0; start < file.size; start += FileSave.CHUNK_BYTES) {
|
|
67
|
+
const piece = new Uint8Array(await file.slice(start, start + FileSave.CHUNK_BYTES).arrayBuffer());
|
|
68
|
+
app.post({ id, action: 'chunk', data: base64(piece) });
|
|
69
|
+
}
|
|
70
|
+
app.post({ id, action: 'end' });
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
globalThis.removeEventListener(FileSave.EVENT, onEvent);
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
return answer;
|
|
77
|
+
}
|
|
78
|
+
FileSave.save = save;
|
|
79
|
+
})(FileSave || (FileSave = {}));
|
|
80
|
+
//# sourceMappingURL=file-save.js.map
|