@celljs/ta-web 4.49.0 → 4.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/account/account-side.js +4 -0
- package/esm/browser/account/device-account.d.ts +6 -0
- package/esm/browser/account/device-account.js +20 -5
- package/esm/browser/assistant/assistant-view.js +2 -0
- package/esm/browser/assistant/call-announcing.d.ts +25 -0
- package/esm/browser/assistant/call-announcing.js +32 -0
- package/esm/browser/assistant/call-answering.d.ts +43 -0
- package/esm/browser/assistant/call-answering.js +63 -0
- package/esm/browser/assistant/call-hearing.d.ts +53 -0
- package/esm/browser/assistant/call-hearing.js +98 -0
- package/esm/browser/assistant/call-pausing.d.ts +40 -0
- package/esm/browser/assistant/call-pausing.js +82 -0
- package/esm/browser/assistant/call-reading.d.ts +32 -0
- package/esm/browser/assistant/call-reading.js +35 -0
- package/esm/browser/assistant/call-revoicing.d.ts +33 -0
- package/esm/browser/assistant/call-revoicing.js +68 -0
- package/esm/browser/assistant/call-turns.d.ts +29 -0
- package/esm/browser/assistant/call-turns.js +33 -0
- package/esm/browser/assistant/spoken-answer.d.ts +21 -0
- package/esm/browser/assistant/spoken-answer.js +69 -0
- package/esm/browser/assistant/spoken-call.d.ts +7 -0
- package/esm/browser/assistant/spoken-call.js +16 -0
- package/esm/browser/assistant/voice-call-protocol.d.ts +5 -0
- package/esm/browser/assistant/voice-call.d.ts +47 -43
- package/esm/browser/assistant/voice-call.js +193 -219
- package/esm/browser/chat/chat-view.js +2 -1
- package/esm/browser/components/account-recovery-view.d.ts +11 -0
- package/esm/browser/components/account-recovery-view.js +81 -0
- package/esm/browser/components/account-view.d.ts +1 -2
- package/esm/browser/components/account-view.js +10 -1
- package/esm/browser/components/app-nav.js +19 -8
- package/esm/browser/components/app-shell-hooks.d.ts +5 -0
- package/esm/browser/components/app-shell-hooks.js +45 -0
- package/esm/browser/components/app-shell-state.js +2 -1
- package/esm/browser/components/app-view.js +9 -5
- package/esm/browser/components/chat-emoji.d.ts +35 -0
- package/esm/browser/components/chat-emoji.js +129 -0
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/composer-attachments.d.ts +6 -0
- package/esm/browser/components/composer-attachments.js +12 -1
- package/esm/browser/components/composer-box-protocol.d.ts +15 -0
- package/esm/browser/components/composer-box.js +110 -87
- package/esm/browser/components/composer-drop-hooks.d.ts +26 -0
- package/esm/browser/components/composer-drop-hooks.js +36 -0
- package/esm/browser/components/composer-emoji.js +1 -1
- package/esm/browser/components/composer-faces.d.ts +16 -0
- package/esm/browser/components/composer-faces.js +37 -0
- package/esm/browser/components/composer-media.d.ts +10 -0
- package/esm/browser/components/composer-media.js +12 -1
- package/esm/browser/components/composer-target.d.ts +4 -0
- package/esm/browser/components/composer-target.js +18 -7
- package/esm/browser/components/composer-type-focus.d.ts +24 -0
- package/esm/browser/components/composer-type-focus.js +17 -0
- package/esm/browser/components/composer-voice.d.ts +24 -0
- package/esm/browser/components/composer-voice.js +37 -0
- package/esm/browser/components/composer.d.ts +2 -2
- package/esm/browser/components/composer.js +39 -8
- package/esm/browser/components/context-menu.js +2 -1
- package/esm/browser/components/emoji-panel.d.ts +11 -7
- package/esm/browser/components/emoji-panel.js +40 -22
- package/esm/browser/components/extension-settings.js +2 -2
- package/esm/browser/components/folder-new.d.ts +18 -0
- package/esm/browser/components/folder-new.js +53 -0
- package/esm/browser/components/folder-picker.d.ts +5 -2
- package/esm/browser/components/folder-picker.js +18 -6
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/image-menu.d.ts +8 -3
- package/esm/browser/components/image-menu.js +34 -9
- package/esm/browser/components/markdown.js +9 -2
- package/esm/browser/components/media.js +3 -2
- package/esm/browser/components/message-list.js +2 -2
- package/esm/browser/components/message-steps.js +20 -11
- package/esm/browser/components/message-user.js +2 -2
- package/esm/browser/components/moved-notice.js +2 -1
- package/esm/browser/components/nav-places.d.ts +2 -0
- package/esm/browser/components/nav-places.js +4 -2
- package/esm/browser/components/phone-shell.d.ts +2 -0
- package/esm/browser/components/phone-shell.js +5 -1
- package/esm/browser/components/secret-text.d.ts +1 -1
- package/esm/browser/components/secret-text.js +4 -3
- package/esm/browser/components/session-view.js +3 -0
- package/esm/browser/components/settings-choices.d.ts +2 -1
- package/esm/browser/components/settings-choices.js +13 -5
- package/esm/browser/components/settings-more.js +3 -3
- package/esm/browser/components/settings-parts.js +13 -2
- package/esm/browser/components/share-item-sheet.js +7 -1
- package/esm/browser/components/tab-title.d.ts +27 -0
- package/esm/browser/components/tab-title.js +35 -0
- package/esm/browser/components/use-composer-attachments.d.ts +28 -0
- package/esm/browser/components/use-composer-attachments.js +65 -0
- package/esm/browser/components/use-composer-files.d.ts +25 -0
- package/esm/browser/components/use-composer-files.js +52 -0
- package/esm/browser/components/web-composer.d.ts +3 -1
- package/esm/browser/components/web-composer.js +3 -2
- package/esm/browser/components/workbench-view.js +1 -0
- package/esm/browser/components/working-directory.js +2 -1
- package/esm/browser/device/drag-move.d.ts +21 -0
- package/esm/browser/device/drag-move.js +86 -0
- package/esm/browser/extension/icons.js +7 -1
- package/esm/browser/extension/web-api-desktop.d.ts +19 -0
- package/esm/browser/extension/web-api-menus.d.ts +19 -0
- package/esm/browser/extension/web-api-spec.js +2 -0
- package/esm/browser/extension/web-extension-api.d.ts +24 -23
- package/esm/browser/extension/web-extension-context.d.ts +1 -0
- package/esm/browser/extension/web-extension-context.js +12 -5
- package/esm/browser/extension/web-extension-run.js +1 -0
- package/esm/browser/extension/web-share-ui.d.ts +1 -1
- package/esm/browser/extension/web-share-ui.js +2 -0
- package/esm/browser/extension/web-share.d.ts +13 -0
- package/esm/browser/extension/web-share.js +37 -2
- package/esm/browser/i18n/en/account.d.ts +18 -0
- package/esm/browser/i18n/en/account.js +18 -0
- package/esm/browser/i18n/en/call.js +1 -1
- package/esm/browser/i18n/en/chat.d.ts +15 -0
- package/esm/browser/i18n/en/chat.js +16 -1
- package/esm/browser/i18n/en/common.d.ts +2 -0
- package/esm/browser/i18n/en/common.js +2 -0
- package/esm/browser/i18n/en/discover.d.ts +2 -0
- package/esm/browser/i18n/en/discover.js +2 -0
- package/esm/browser/i18n/en/settings.d.ts +17 -0
- package/esm/browser/i18n/en/settings.js +17 -0
- package/esm/browser/i18n/ja/account.js +18 -0
- package/esm/browser/i18n/ja/call.js +1 -1
- package/esm/browser/i18n/ja/chat.js +16 -1
- package/esm/browser/i18n/ja/common.js +2 -0
- package/esm/browser/i18n/ja/discover.js +3 -1
- package/esm/browser/i18n/ja/settings.js +17 -0
- package/esm/browser/i18n/locales.d.ts +55 -1
- package/esm/browser/i18n/messages.d.ts +54 -0
- package/esm/browser/i18n/zh/account.js +18 -0
- package/esm/browser/i18n/zh/call.js +1 -1
- package/esm/browser/i18n/zh/chat.js +16 -1
- package/esm/browser/i18n/zh/common.js +2 -0
- package/esm/browser/i18n/zh/discover.js +3 -1
- package/esm/browser/i18n/zh/settings.js +17 -0
- package/esm/browser/i18n/zh-tw/account.js +18 -0
- package/esm/browser/i18n/zh-tw/call.js +1 -1
- package/esm/browser/i18n/zh-tw/chat.js +16 -1
- package/esm/browser/i18n/zh-tw/common.js +2 -0
- package/esm/browser/i18n/zh-tw/discover.js +3 -1
- package/esm/browser/i18n/zh-tw/settings.js +17 -0
- package/esm/browser/offline/kept-chats.d.ts +3 -1
- package/esm/browser/offline/kept-chats.js +1 -1
- package/esm/browser/partners/group-picker.d.ts +3 -2
- package/esm/browser/partners/group-picker.js +8 -3
- package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/esm/browser/sandbox/work/work-docs.js +5 -2
- package/esm/browser/sandbox/work/work-frame.d.ts +3 -0
- package/esm/browser/sandbox/work/work-frame.js +9 -3
- package/esm/browser/sandbox/work/work-gates.d.ts +77 -0
- package/esm/browser/sandbox/work/work-gates.js +182 -0
- package/esm/browser/settings/agent-settings.js +1 -1
- package/esm/browser/settings/navigation.d.ts +38 -10
- package/esm/browser/settings/navigation.js +73 -17
- package/esm/browser/settings/settings-protocol.d.ts +16 -1
- package/esm/browser/settings/settings-protocol.js +20 -2
- package/esm/browser/settings/settings.js +4 -1
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +15 -2
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +6 -3
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation-column.js +28 -8
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +5 -0
- package/esm/browser/style/device.js +5 -0
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +3 -3
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +13 -6
- package/esm/browser/style/tasks.d.ts +1 -1
- package/esm/browser/style/tasks.js +4 -2
- package/esm/browser/util/chat-emoji.d.ts +44 -0
- package/esm/browser/util/chat-emoji.js +269 -0
- package/esm/browser/util/composer-drop.d.ts +26 -0
- package/esm/browser/util/composer-drop.js +40 -0
- package/esm/browser/util/composer-files.d.ts +48 -0
- package/esm/browser/util/composer-files.js +99 -0
- package/esm/browser/util/composer.d.ts +13 -1
- package/esm/browser/util/composer.js +24 -6
- package/esm/browser/util/markdown.d.ts +5 -0
- package/esm/browser/util/markdown.js +18 -0
- package/esm/browser/util/message.d.ts +6 -1
- package/esm/browser/util/message.js +13 -2
- package/esm/browser/util/process.d.ts +10 -13
- package/esm/browser/util/process.js +31 -83
- package/esm/browser/util/turn-join.d.ts +38 -0
- package/esm/browser/util/turn-join.js +119 -0
- package/esm/browser/workbench-services.js +1 -1
- package/lib/browser/account/account-side.js +4 -0
- package/lib/browser/account/device-account.d.ts +6 -0
- package/lib/browser/account/device-account.js +20 -5
- package/lib/browser/assistant/assistant-view.js +2 -0
- package/lib/browser/assistant/call-announcing.d.ts +26 -0
- package/lib/browser/assistant/call-announcing.js +36 -0
- package/lib/browser/assistant/call-answering.d.ts +44 -0
- package/lib/browser/assistant/call-answering.js +67 -0
- package/lib/browser/assistant/call-hearing.d.ts +54 -0
- package/lib/browser/assistant/call-hearing.js +102 -0
- package/lib/browser/assistant/call-pausing.d.ts +41 -0
- package/lib/browser/assistant/call-pausing.js +86 -0
- package/lib/browser/assistant/call-reading.d.ts +33 -0
- package/lib/browser/assistant/call-reading.js +39 -0
- package/lib/browser/assistant/call-revoicing.d.ts +34 -0
- package/lib/browser/assistant/call-revoicing.js +72 -0
- package/lib/browser/assistant/call-turns.d.ts +30 -0
- package/lib/browser/assistant/call-turns.js +37 -0
- package/lib/browser/assistant/spoken-answer.d.ts +22 -0
- package/lib/browser/assistant/spoken-answer.js +73 -0
- package/lib/browser/assistant/spoken-call.d.ts +8 -0
- package/lib/browser/assistant/spoken-call.js +19 -0
- package/lib/browser/assistant/voice-call-protocol.d.ts +5 -0
- package/lib/browser/assistant/voice-call.d.ts +47 -43
- package/lib/browser/assistant/voice-call.js +192 -218
- package/lib/browser/chat/chat-view.js +2 -1
- package/lib/browser/components/account-recovery-view.d.ts +12 -0
- package/lib/browser/components/account-recovery-view.js +117 -0
- package/lib/browser/components/account-view.d.ts +1 -2
- package/lib/browser/components/account-view.js +10 -1
- package/lib/browser/components/app-nav.js +19 -8
- package/lib/browser/components/app-shell-hooks.d.ts +5 -0
- package/lib/browser/components/app-shell-hooks.js +46 -0
- package/lib/browser/components/app-shell-state.js +1 -0
- package/lib/browser/components/app-view.js +8 -4
- package/lib/browser/components/chat-emoji.d.ts +36 -0
- package/lib/browser/components/chat-emoji.js +167 -0
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/composer-attachments.d.ts +6 -0
- package/lib/browser/components/composer-attachments.js +12 -0
- package/lib/browser/components/composer-box-protocol.d.ts +15 -0
- package/lib/browser/components/composer-box.js +107 -84
- package/lib/browser/components/composer-drop-hooks.d.ts +27 -0
- package/lib/browser/components/composer-drop-hooks.js +72 -0
- package/lib/browser/components/composer-emoji.js +1 -1
- package/lib/browser/components/composer-faces.d.ts +17 -0
- package/lib/browser/components/composer-faces.js +73 -0
- package/lib/browser/components/composer-media.d.ts +10 -0
- package/lib/browser/components/composer-media.js +13 -0
- package/lib/browser/components/composer-target.d.ts +4 -0
- package/lib/browser/components/composer-target.js +18 -7
- package/lib/browser/components/composer-type-focus.d.ts +25 -0
- package/lib/browser/components/composer-type-focus.js +20 -0
- package/lib/browser/components/composer-voice.d.ts +25 -0
- package/lib/browser/components/composer-voice.js +73 -0
- package/lib/browser/components/composer.d.ts +2 -2
- package/lib/browser/components/composer.js +38 -7
- package/lib/browser/components/context-menu.js +2 -1
- package/lib/browser/components/emoji-panel.d.ts +11 -7
- package/lib/browser/components/emoji-panel.js +40 -22
- package/lib/browser/components/extension-settings.js +1 -1
- package/lib/browser/components/folder-new.d.ts +19 -0
- package/lib/browser/components/folder-new.js +90 -0
- package/lib/browser/components/folder-picker.d.ts +5 -2
- package/lib/browser/components/folder-picker.js +17 -5
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/image-menu.d.ts +8 -3
- package/lib/browser/components/image-menu.js +34 -9
- package/lib/browser/components/markdown.js +9 -2
- package/lib/browser/components/media.js +3 -2
- package/lib/browser/components/message-list.js +2 -2
- package/lib/browser/components/message-steps.js +20 -11
- package/lib/browser/components/message-user.js +1 -1
- package/lib/browser/components/moved-notice.js +2 -1
- package/lib/browser/components/nav-places.d.ts +2 -0
- package/lib/browser/components/nav-places.js +4 -2
- package/lib/browser/components/phone-shell.d.ts +2 -0
- package/lib/browser/components/phone-shell.js +5 -1
- package/lib/browser/components/secret-text.d.ts +1 -1
- package/lib/browser/components/secret-text.js +4 -3
- package/lib/browser/components/session-view.js +3 -0
- package/lib/browser/components/settings-choices.d.ts +2 -1
- package/lib/browser/components/settings-choices.js +12 -4
- package/lib/browser/components/settings-more.js +2 -2
- package/lib/browser/components/settings-parts.js +11 -0
- package/lib/browser/components/share-item-sheet.js +7 -1
- package/lib/browser/components/tab-title.d.ts +28 -0
- package/lib/browser/components/tab-title.js +38 -0
- package/lib/browser/components/use-composer-attachments.d.ts +29 -0
- package/lib/browser/components/use-composer-attachments.js +101 -0
- package/lib/browser/components/use-composer-files.d.ts +26 -0
- package/lib/browser/components/use-composer-files.js +88 -0
- package/lib/browser/components/web-composer.d.ts +3 -1
- package/lib/browser/components/web-composer.js +3 -2
- package/lib/browser/components/workbench-view.js +1 -0
- package/lib/browser/components/working-directory.js +2 -1
- package/lib/browser/device/drag-move.d.ts +22 -0
- package/lib/browser/device/drag-move.js +122 -0
- package/lib/browser/extension/icons.js +6 -0
- package/lib/browser/extension/web-api-desktop.d.ts +19 -0
- package/lib/browser/extension/web-api-menus.d.ts +19 -0
- package/lib/browser/extension/web-api-spec.js +2 -0
- package/lib/browser/extension/web-extension-api.d.ts +24 -23
- package/lib/browser/extension/web-extension-context.d.ts +1 -0
- package/lib/browser/extension/web-extension-context.js +12 -5
- package/lib/browser/extension/web-extension-run.js +1 -0
- package/lib/browser/extension/web-share-ui.d.ts +1 -1
- package/lib/browser/extension/web-share-ui.js +2 -0
- package/lib/browser/extension/web-share.d.ts +13 -0
- package/lib/browser/extension/web-share.js +37 -2
- package/lib/browser/i18n/en/account.d.ts +18 -0
- package/lib/browser/i18n/en/account.js +18 -0
- package/lib/browser/i18n/en/call.js +1 -1
- package/lib/browser/i18n/en/chat.d.ts +15 -0
- package/lib/browser/i18n/en/chat.js +16 -1
- package/lib/browser/i18n/en/common.d.ts +2 -0
- package/lib/browser/i18n/en/common.js +2 -0
- package/lib/browser/i18n/en/discover.d.ts +2 -0
- package/lib/browser/i18n/en/discover.js +2 -0
- package/lib/browser/i18n/en/settings.d.ts +17 -0
- package/lib/browser/i18n/en/settings.js +17 -0
- package/lib/browser/i18n/ja/account.js +18 -0
- package/lib/browser/i18n/ja/call.js +1 -1
- package/lib/browser/i18n/ja/chat.js +16 -1
- package/lib/browser/i18n/ja/common.js +2 -0
- package/lib/browser/i18n/ja/discover.js +3 -1
- package/lib/browser/i18n/ja/settings.js +17 -0
- package/lib/browser/i18n/locales.d.ts +55 -1
- package/lib/browser/i18n/messages.d.ts +54 -0
- package/lib/browser/i18n/zh/account.js +18 -0
- package/lib/browser/i18n/zh/call.js +1 -1
- package/lib/browser/i18n/zh/chat.js +16 -1
- package/lib/browser/i18n/zh/common.js +2 -0
- package/lib/browser/i18n/zh/discover.js +3 -1
- package/lib/browser/i18n/zh/settings.js +17 -0
- package/lib/browser/i18n/zh-tw/account.js +18 -0
- package/lib/browser/i18n/zh-tw/call.js +1 -1
- package/lib/browser/i18n/zh-tw/chat.js +16 -1
- package/lib/browser/i18n/zh-tw/common.js +2 -0
- package/lib/browser/i18n/zh-tw/discover.js +3 -1
- package/lib/browser/i18n/zh-tw/settings.js +17 -0
- package/lib/browser/offline/kept-chats.d.ts +3 -1
- package/lib/browser/offline/kept-chats.js +1 -1
- package/lib/browser/partners/group-picker.d.ts +3 -2
- package/lib/browser/partners/group-picker.js +8 -3
- package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/lib/browser/sandbox/work/work-docs.js +5 -2
- package/lib/browser/sandbox/work/work-frame.d.ts +3 -0
- package/lib/browser/sandbox/work/work-frame.js +9 -3
- package/lib/browser/sandbox/work/work-gates.d.ts +78 -0
- package/lib/browser/sandbox/work/work-gates.js +185 -0
- package/lib/browser/settings/agent-settings.js +1 -1
- package/lib/browser/settings/navigation.d.ts +38 -10
- package/lib/browser/settings/navigation.js +74 -18
- package/lib/browser/settings/settings-protocol.d.ts +16 -1
- package/lib/browser/settings/settings-protocol.js +21 -3
- package/lib/browser/settings/settings.js +3 -0
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +15 -2
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +6 -3
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation-column.js +28 -8
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +5 -0
- package/lib/browser/style/device.js +5 -0
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +3 -3
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +13 -6
- package/lib/browser/style/tasks.d.ts +1 -1
- package/lib/browser/style/tasks.js +4 -2
- package/lib/browser/util/chat-emoji.d.ts +45 -0
- package/lib/browser/util/chat-emoji.js +272 -0
- package/lib/browser/util/composer-drop.d.ts +27 -0
- package/lib/browser/util/composer-drop.js +43 -0
- package/lib/browser/util/composer-files.d.ts +49 -0
- package/lib/browser/util/composer-files.js +102 -0
- package/lib/browser/util/composer.d.ts +13 -1
- package/lib/browser/util/composer.js +24 -6
- package/lib/browser/util/markdown.d.ts +5 -0
- package/lib/browser/util/markdown.js +18 -0
- package/lib/browser/util/message.d.ts +6 -1
- package/lib/browser/util/message.js +13 -2
- package/lib/browser/util/process.d.ts +10 -13
- package/lib/browser/util/process.js +32 -84
- package/lib/browser/util/turn-join.d.ts +39 -0
- package/lib/browser/util/turn-join.js +122 -0
- package/lib/browser/workbench-services.js +1 -1
- package/package.json +7 -7
- package/public/emoji/wechat-v1.webp +0 -0
|
@@ -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
|
}
|
|
@@ -85,6 +85,13 @@ var ComposerUtil;
|
|
|
85
85
|
return [...starts, ...contains].slice(0, limit);
|
|
86
86
|
}
|
|
87
87
|
ComposerUtil.commands = commands;
|
|
88
|
+
/** How long after a send the button, turned to stop under the pointer, does not stop: a double click meant one send. */
|
|
89
|
+
ComposerUtil.STOP_GUARD_MS = 400;
|
|
90
|
+
/** A press of the stop button so soon after a send that it was the send pressed twice, not a stop. */
|
|
91
|
+
function accidentalStop(sentAt, now) {
|
|
92
|
+
return sentAt !== undefined && now - sentAt >= 0 && now - sentAt < ComposerUtil.STOP_GUARD_MS;
|
|
93
|
+
}
|
|
94
|
+
ComposerUtil.accidentalStop = accidentalStop;
|
|
88
95
|
/** One button sends and stops: it stops while the agent works, or the conversation is compacted, and there is nothing to send. */
|
|
89
96
|
function action(working, sendable, compacting = false) {
|
|
90
97
|
return (working || compacting) && !sendable ? 'stop' : 'send';
|
|
@@ -172,18 +179,29 @@ var ComposerUtil;
|
|
|
172
179
|
ComposerUtil.fileNote = fileNote;
|
|
173
180
|
/** Waiting messages, the steering ones first: they go in before the follow-ups. */
|
|
174
181
|
function queued(queue) {
|
|
175
|
-
return [
|
|
176
|
-
|
|
177
|
-
...queue.followUp.map((text, index) => ({ kind: 'followUp', index, text })),
|
|
178
|
-
];
|
|
182
|
+
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 }); });
|
|
183
|
+
return [...of('steering'), ...of('followUp')];
|
|
179
184
|
}
|
|
180
185
|
ComposerUtil.queued = queued;
|
|
181
186
|
/** The queue without one of its messages. */
|
|
182
187
|
function without(queue, entry) {
|
|
183
|
-
const rest = (kind) =>
|
|
184
|
-
|
|
188
|
+
const rest = (kind, of) => of.filter((_, index) => kind !== entry.kind || index !== entry.index);
|
|
189
|
+
const { images } = queue;
|
|
190
|
+
return {
|
|
191
|
+
steering: rest('steering', queue.steering),
|
|
192
|
+
followUp: rest('followUp', queue.followUp),
|
|
193
|
+
...(images ? { images: { steering: rest('steering', images.steering), followUp: rest('followUp', images.followUp) } } : {}),
|
|
194
|
+
};
|
|
185
195
|
}
|
|
186
196
|
ComposerUtil.without = without;
|
|
197
|
+
/** An image as the box takes a file pasted (ComposerBoxHandle.addFiles): one that was sent, back into it. */
|
|
198
|
+
function imageFile({ data, mimeType }, index) {
|
|
199
|
+
var _a;
|
|
200
|
+
const bytes = Uint8Array.from(atob(data), char => char.charCodeAt(0));
|
|
201
|
+
const extension = ((_a = mimeType.split('/')[1]) === null || _a === void 0 ? void 0 : _a.replace('jpeg', 'jpg')) || 'png';
|
|
202
|
+
return new File([bytes], `picked-${index + 1}.${extension}`, { type: mimeType });
|
|
203
|
+
}
|
|
204
|
+
ComposerUtil.imageFile = imageFile;
|
|
187
205
|
/** The text of messages taken back out of the queue, before what is in the box, or after it (`after`). */
|
|
188
206
|
function restore(queue, text, after = false) {
|
|
189
207
|
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';
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MarkdownUtil = exports.MARKDOWN_TINTS = exports.CALLOUT_KINDS = void 0;
|
|
4
4
|
const local_refs_1 = require("@celljs/ta-protocol/lib/common/local-refs");
|
|
5
|
+
const chat_emoji_1 = require("./chat-emoji");
|
|
5
6
|
const link_1 = require("./link");
|
|
6
7
|
exports.CALLOUT_KINDS = ['note', 'tip', 'important', 'warning', 'caution'];
|
|
7
8
|
exports.MARKDOWN_TINTS = ['red', 'orange', 'yellow', 'green', 'blue', 'purple', 'gray'];
|
|
@@ -50,6 +51,9 @@ const BEFORE_URL = /[\w/.@:-]/;
|
|
|
50
51
|
/** `$x$`: no space inside the dollars, no digit after the closing one, so that `$5 and $10` stays text. */
|
|
51
52
|
const INLINE_MATH = /^\$(?=[^\s$])([^$]*?[^\s$\\])\$(?!\d)/;
|
|
52
53
|
const PUNCTUATION = /[!-/:-@[-`{-~]/;
|
|
54
|
+
/** The entities of HTML that Markdown reads as their characters (> is >), as CommonMark does: the common ones and numeric. */
|
|
55
|
+
const ENTITY = /^&(?:(lt|gt|amp|quot|apos|nbsp)|#(\d{1,7})|#[xX]([0-9a-fA-F]{1,6}));/;
|
|
56
|
+
const ENTITIES = { lt: '<', gt: '>', amp: '&', quot: '"', apos: "'", nbsp: '\u00a0' };
|
|
53
57
|
/**
|
|
54
58
|
* The last line of a reply still coming that may yet turn into something else: the start of a fence, a
|
|
55
59
|
* heading, a list, a rule or a row of a table. It shows once the next character tells what it is.
|
|
@@ -366,6 +370,13 @@ var MarkdownUtil;
|
|
|
366
370
|
i += marked[0].length;
|
|
367
371
|
continue;
|
|
368
372
|
}
|
|
373
|
+
// A face said as its name ([微笑]), as WeChat says them, drawn as its picture; other brackets stay words.
|
|
374
|
+
const face = chat_emoji_1.ChatEmojiUtil.at(text, i);
|
|
375
|
+
if (face) {
|
|
376
|
+
push({ type: 'face', index: face.index });
|
|
377
|
+
i += face.length;
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
369
380
|
const note = text[i] === '[' ? NOTE_MARK.exec(rest) : null;
|
|
370
381
|
if (note) {
|
|
371
382
|
push({ type: 'note', label: note[1] });
|
|
@@ -407,6 +418,13 @@ var MarkdownUtil;
|
|
|
407
418
|
i += url.length;
|
|
408
419
|
continue;
|
|
409
420
|
}
|
|
421
|
+
const entity = text[i] === '&' ? ENTITY.exec(rest) : null;
|
|
422
|
+
if (entity) {
|
|
423
|
+
const point = entity[2] ? Number(entity[2]) : entity[3] ? Number.parseInt(entity[3], 16) : undefined;
|
|
424
|
+
plain += point === undefined ? ENTITIES[entity[1]] : point > 0 && point <= 0x10ffff ? String.fromCodePoint(point) : '\ufffd';
|
|
425
|
+
i += entity[0].length;
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
410
428
|
plain += text[i++];
|
|
411
429
|
}
|
|
412
430
|
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`),
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MessageUtil = void 0;
|
|
4
4
|
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
5
5
|
const link_1 = require("./link");
|
|
6
|
+
/** The `Continue` of the button under a turn cut short (`ta.message.resumeText`), the four languages Ta speaks. */
|
|
7
|
+
const CONTINUE = new Set(['继续', '繼續', 'continue', '続行']);
|
|
6
8
|
const SCRIPT_HEADER = /^Script (completed|failed)\nWall time [\d.]+ seconds\nOutput:\n/;
|
|
7
9
|
/** What a fetch or a provider says when it was stopped with its abort signal (DOMException AbortError). */
|
|
8
10
|
const ABORTED = /^(this|the) operation was aborted\.?$|^(request )?aborted\.?$/i;
|
|
@@ -29,7 +31,7 @@ var MessageUtil;
|
|
|
29
31
|
/**
|
|
30
32
|
* The last message of the user while nothing came of it yet: after it only thinking, no words and no tool
|
|
31
33
|
* called. Stopped then, it goes back into the box to change and send again (a rewind to it, as pi's
|
|
32
|
-
* `/tree`)
|
|
34
|
+
* `/tree`), its images with it.
|
|
33
35
|
*/
|
|
34
36
|
function unanswered(messages) {
|
|
35
37
|
let index = messages.length - 1;
|
|
@@ -44,7 +46,7 @@ var MessageUtil;
|
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
const message = messages[index];
|
|
47
|
-
return message &&
|
|
49
|
+
return message && (text(blocks(message)).trim() || blocks(message).some(block => block.type === 'image')) ? message : undefined;
|
|
48
50
|
}
|
|
49
51
|
MessageUtil.unanswered = unanswered;
|
|
50
52
|
function blocks(message) {
|
|
@@ -55,6 +57,15 @@ var MessageUtil;
|
|
|
55
57
|
return Array.isArray(content) ? content : [];
|
|
56
58
|
}
|
|
57
59
|
MessageUtil.blocks = blocks;
|
|
60
|
+
/**
|
|
61
|
+
* The message is the `Continue` of the button under a turn that stopped short (`ta.message.resumeText`, in every
|
|
62
|
+
* language Ta speaks), which the page sent as words of the user: what the turn goes on, not a request of its own.
|
|
63
|
+
*/
|
|
64
|
+
function continued(message) {
|
|
65
|
+
const words = text(blocks(message)).trim().toLowerCase();
|
|
66
|
+
return CONTINUE.has(words);
|
|
67
|
+
}
|
|
68
|
+
MessageUtil.continued = continued;
|
|
58
69
|
function text(content) {
|
|
59
70
|
if (typeof content === 'string') {
|
|
60
71
|
return content;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SessionMessage } from '@celljs/ta-client';
|
|
2
2
|
import type { Mood } from '../avatar/dino-avatar';
|
|
3
3
|
import { type ContentBlock } from './message';
|
|
4
|
+
import { TurnJoin } from './turn-join';
|
|
4
5
|
/** One step of the work of ta between two messages of the user. */
|
|
5
6
|
export type ProcessStep = {
|
|
6
7
|
kind: 'thinking';
|
|
@@ -33,11 +34,15 @@ export type ProcessStep = {
|
|
|
33
34
|
key: string;
|
|
34
35
|
text: string;
|
|
35
36
|
}
|
|
36
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* What the user said while it worked, which pi gave it after the results of its tools (steering): it went on
|
|
39
|
+
* with it. `wentOn`: they said it once the turn had stopped short, and it goes on from there.
|
|
40
|
+
*/
|
|
37
41
|
| {
|
|
38
42
|
kind: 'said';
|
|
39
43
|
key: string;
|
|
40
44
|
message: SessionMessage;
|
|
45
|
+
wentOn?: boolean;
|
|
41
46
|
}
|
|
42
47
|
/**
|
|
43
48
|
* Ta restarted in the middle of the work and it went on from there (TA_RESUME_MESSAGE), or a part of Ta told it
|
|
@@ -127,18 +132,10 @@ export declare namespace ProcessUtil {
|
|
|
127
132
|
index: number;
|
|
128
133
|
message: SessionMessage;
|
|
129
134
|
}): ThreadItem[];
|
|
130
|
-
/**
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
*/
|
|
135
|
-
function steered(messages: readonly SessionMessage[], index: number): boolean;
|
|
136
|
-
/**
|
|
137
|
-
* The message at `index` is a notice of a part of Ta (TaMessageSource.notice) that had a turn cut short go on (moved
|
|
138
|
-
* to the cloud as it worked, a grant it waited for): a step of that turn, as a restart of Ta is, not a row of its own.
|
|
139
|
-
* The turn was cut short: its last answer was stopped or failed, or ended on its calls with no answer after them.
|
|
140
|
-
*/
|
|
141
|
-
function carried(messages: readonly SessionMessage[], index: number): boolean;
|
|
135
|
+
/** The message at `index`, of the user, steered a turn: a step of its turn, not an ask (TurnJoin.steered). */
|
|
136
|
+
const steered: typeof TurnJoin.steered;
|
|
137
|
+
/** The message at `index` is a notice of a part of Ta that had a turn cut short go on (TurnJoin.carried). */
|
|
138
|
+
const carried: typeof TurnJoin.carried;
|
|
142
139
|
/**
|
|
143
140
|
* Words on the way with a fenced block a web extension draws (WebExtensionAPI.registerCodeRenderer,
|
|
144
141
|
* `renderers` by language in lower case): a card for the user, as a choice to make, stays in sight when
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ProcessUtil = exports.TIME_BREAK_MS = exports.VISIBLE_STEPS = void 0;
|
|
4
4
|
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
5
5
|
const message_1 = require("./message");
|
|
6
|
+
const turn_join_1 = require("./turn-join");
|
|
6
7
|
/** While the agent works, only the latest steps show; the earlier ones fold into one row. */
|
|
7
8
|
exports.VISIBLE_STEPS = 8;
|
|
8
9
|
/** A time shows between two items of the conversation this long apart, as in WeChat. */
|
|
9
10
|
exports.TIME_BREAK_MS = 5 * 60000;
|
|
10
|
-
const TURN_ROLES = new Set(['assistant', 'toolResult']);
|
|
11
11
|
/**
|
|
12
12
|
* How the conversation is laid out (thinking and tool calls folded into steps): pure functions over pi's
|
|
13
13
|
* messages, so that a component only draws what they return.
|
|
@@ -34,7 +34,7 @@ var ProcessUtil;
|
|
|
34
34
|
let index = 0;
|
|
35
35
|
while (index < messages.length) {
|
|
36
36
|
const role = messages[index].role;
|
|
37
|
-
if (!TURN_ROLES.has(role) && !resumed(messages[index]) && !carried(messages, index)) {
|
|
37
|
+
if (!turn_join_1.TURN_ROLES.has(role) && !resumed(messages[index]) && !ProcessUtil.carried(messages, index) && !afterStopped(messages, index)) {
|
|
38
38
|
const item = { kind: 'message', key: `m${offset + index}`, message: messages[index] };
|
|
39
39
|
if (index > 0 && writtenBefore(messages[index], messages[index - 1])) {
|
|
40
40
|
item.queued = true;
|
|
@@ -45,11 +45,12 @@ var ProcessUtil;
|
|
|
45
45
|
}
|
|
46
46
|
const start = index;
|
|
47
47
|
while (index < messages.length &&
|
|
48
|
-
(TURN_ROLES.has(messages[index].role) ||
|
|
48
|
+
(turn_join_1.TURN_ROLES.has(messages[index].role) ||
|
|
49
49
|
resumed(messages[index]) ||
|
|
50
50
|
hidden(messages[index], renderers) ||
|
|
51
|
-
steered(messages, index) ||
|
|
52
|
-
|
|
51
|
+
ProcessUtil.steered(messages, index) ||
|
|
52
|
+
afterStopped(messages, index) ||
|
|
53
|
+
ProcessUtil.carried(messages, index) ||
|
|
53
54
|
beforeCarried(messages, index))) {
|
|
54
55
|
index++;
|
|
55
56
|
}
|
|
@@ -62,31 +63,16 @@ var ProcessUtil;
|
|
|
62
63
|
return items;
|
|
63
64
|
}
|
|
64
65
|
ProcessUtil.items = items;
|
|
66
|
+
/** The message at `index`, of the user, steered a turn: a step of its turn, not an ask (TurnJoin.steered). */
|
|
67
|
+
ProcessUtil.steered = turn_join_1.TurnJoin.steered;
|
|
68
|
+
/** The message at `index` is a notice of a part of Ta that had a turn cut short go on (TurnJoin.carried). */
|
|
69
|
+
ProcessUtil.carried = turn_join_1.TurnJoin.carried;
|
|
70
|
+
const { afterStopped, beforeCarried, resumed, resumedOnline, writtenBefore } = turn_join_1.TurnJoin;
|
|
65
71
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
|
|
70
|
-
function steered(messages, index) {
|
|
71
|
-
var _a;
|
|
72
|
-
if (((_a = messages[index]) === null || _a === void 0 ? void 0 : _a.role) !== 'user') {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
for (let before = index - 1; before >= 0; before--) {
|
|
76
|
-
const { role } = messages[before];
|
|
77
|
-
if (role === 'user') {
|
|
78
|
-
return steered(messages, before);
|
|
79
|
-
}
|
|
80
|
-
if (TURN_ROLES.has(role)) {
|
|
81
|
-
return role === 'toolResult' && writtenBefore(messages[index], messages[before]);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
ProcessUtil.steered = steered;
|
|
87
|
-
/**
|
|
88
|
-
* A turn followed only by messages of extensions (role custom, a card shown in the middle of the work) and then by
|
|
89
|
-
* another turn: the work went on after them, so the turn was not cut off where it stopped.
|
|
72
|
+
* A turn followed only by what draws nothing and then by another turn: the work went on after them, so the turn was
|
|
73
|
+
* not cut off where it stopped. What draws nothing is a message of extensions (role custom, a card shown in the
|
|
74
|
+
* middle of the work) and `system`, the prompt pi goes on with when the run is resumed (the user's memory, given
|
|
75
|
+
* again as it is told `继续`): it is of that turn, not the start of a new one.
|
|
90
76
|
*/
|
|
91
77
|
function markContinued(items) {
|
|
92
78
|
var _a;
|
|
@@ -96,65 +82,23 @@ var ProcessUtil;
|
|
|
96
82
|
continue;
|
|
97
83
|
}
|
|
98
84
|
let next = index + 1;
|
|
99
|
-
|
|
85
|
+
const quiet = next;
|
|
86
|
+
while (next < items.length && items[next].kind === 'message' && items[next].message.role !== 'user') {
|
|
100
87
|
next++;
|
|
101
88
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
* The turn was cut short: its last answer was stopped or failed, or ended on its calls with no answer after them.
|
|
111
|
-
*/
|
|
112
|
-
function carried(messages, index) {
|
|
113
|
-
if (!ta_protocol_1.TaSaid.notice(messages[index])) {
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
for (let before = index - 1; before >= 0; before--) {
|
|
117
|
-
const message = messages[before];
|
|
118
|
-
if (message.role === 'toolResult') {
|
|
119
|
-
return true;
|
|
120
|
-
}
|
|
121
|
-
if (message.role === 'assistant') {
|
|
122
|
-
return message.stopReason === 'aborted' || message.stopReason === 'error' || message.stopReason === 'toolUse';
|
|
123
|
-
}
|
|
124
|
-
if (message.role === 'user') {
|
|
125
|
-
return false;
|
|
89
|
+
// Told to go on where it stopped (the `Continue` of the button under a turn cut short): what it goes on
|
|
90
|
+
// into is the work of this turn, not another turn above it.
|
|
91
|
+
const by = next < items.length && items[next].kind === 'message' && message_1.MessageUtil.continued(items[next].message) ? next : undefined;
|
|
92
|
+
if (by !== undefined) {
|
|
93
|
+
next++;
|
|
94
|
+
while (next < items.length && items[next].kind === 'message' && items[next].message.role !== 'user') {
|
|
95
|
+
next++;
|
|
96
|
+
}
|
|
126
97
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
ProcessUtil.carried = carried;
|
|
131
|
-
/**
|
|
132
|
-
* A message of a package or of pi between a turn cut short and the notice that had it go on (the note of a move to
|
|
133
|
-
* the cloud, which the notice says, and the system prompt it goes on with): of that turn too, drawing nothing in it.
|
|
134
|
-
*/
|
|
135
|
-
function beforeCarried(messages, index) {
|
|
136
|
-
for (let at = index; at < messages.length; at++) {
|
|
137
|
-
const { role } = messages[at];
|
|
138
|
-
if (role !== 'custom' && role !== 'system') {
|
|
139
|
-
return role === 'user' && carried(messages, at);
|
|
98
|
+
if (next > quiet && ((_a = items[next]) === null || _a === void 0 ? void 0 : _a.kind) === 'turn') {
|
|
99
|
+
item.continued = true;
|
|
140
100
|
}
|
|
141
101
|
}
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
/** The note that Ta restarted in the middle of a run and went on with it (TaSessionResume). */
|
|
145
|
-
function resumed(message) {
|
|
146
|
-
return message.customType === ta_protocol_1.TA_RESUME_MESSAGE;
|
|
147
|
-
}
|
|
148
|
-
/** The note that the network was back and it went on with the run the network stopped (TaNetworkResume). */
|
|
149
|
-
function resumedOnline(message) {
|
|
150
|
-
var _a;
|
|
151
|
-
return ((_a = message.details) === null || _a === void 0 ? void 0 : _a.reason) === 'network';
|
|
152
|
-
}
|
|
153
|
-
/** `message`, of the user, was written before `previous`, of the agent, came: while the agent worked. */
|
|
154
|
-
function writtenBefore(message, previous) {
|
|
155
|
-
const { role, timestamp } = message;
|
|
156
|
-
const { role: was, timestamp: at } = previous;
|
|
157
|
-
return role === 'user' && !!was && TURN_ROLES.has(was) && typeof timestamp === 'number' && typeof at === 'number' && timestamp < at;
|
|
158
102
|
}
|
|
159
103
|
function turn(messages, start, active) {
|
|
160
104
|
const steps = [];
|
|
@@ -171,6 +115,10 @@ var ProcessUtil;
|
|
|
171
115
|
if (ta_protocol_1.TaMessageSource.isNotice(text)) {
|
|
172
116
|
steps.push({ kind: 'resumed', key: `${start + offset}.u`, text: ta_protocol_1.TaSaid.line(ta_protocol_1.TaSaid.words('user', text), { chars: 160 }) });
|
|
173
117
|
}
|
|
118
|
+
else if (offset > 0 && afterStopped(messages, offset)) {
|
|
119
|
+
// Said once the turn had stopped short: the work goes on from there, not as an ask of its own.
|
|
120
|
+
steps.push({ kind: 'said', key: `${start + offset}.u`, message, wentOn: true });
|
|
121
|
+
}
|
|
174
122
|
else {
|
|
175
123
|
steps.push({ kind: 'said', key: `${start + offset}.u`, message });
|
|
176
124
|
}
|
|
@@ -255,7 +203,7 @@ var ProcessUtil;
|
|
|
255
203
|
if (stopReason === 'aborted') {
|
|
256
204
|
return stopReason;
|
|
257
205
|
}
|
|
258
|
-
const roles = item.messages.map(message => message.role).filter(role => TURN_ROLES.has(role));
|
|
206
|
+
const roles = item.messages.map(message => message.role).filter(role => turn_join_1.TURN_ROLES.has(role));
|
|
259
207
|
if (roles[roles.length - 1] === 'toolResult' || stopReason === 'toolUse') {
|
|
260
208
|
return item.continued ? undefined : 'interrupted';
|
|
261
209
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { SessionMessage } from '@celljs/ta-client';
|
|
2
|
+
/** The roles of a turn of the agent: its answer, and the results of the tools it called. */
|
|
3
|
+
export declare const TURN_ROLES: Set<string>;
|
|
4
|
+
/**
|
|
5
|
+
* Which messages of the conversation belong to the same turn (the work between two asks of the user), as opposed to
|
|
6
|
+
* an ask of its own: what was said on the way while the agent worked, and what it goes on with after a turn stopped
|
|
7
|
+
* short. Over pi's messages, without changing them.
|
|
8
|
+
*/
|
|
9
|
+
export declare namespace TurnJoin {
|
|
10
|
+
/**
|
|
11
|
+
* The message at `index`, of the user, steered a turn: it came after the result of a tool and was written before
|
|
12
|
+
* it, while the agent worked; pi gave it to the agent with the results, and the work went on. One after another
|
|
13
|
+
* that did (written at once) did too. A message of the user that steered is a step of its turn, not an ask.
|
|
14
|
+
*/
|
|
15
|
+
function steered(messages: readonly SessionMessage[], index: number): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The message at `index`, of the user, after a turn they stopped which said nothing more: it goes on in that turn as
|
|
18
|
+
* what was said on the way does, a step of it, rather than as an ask of a turn of its own.
|
|
19
|
+
*/
|
|
20
|
+
function afterStopped(messages: readonly SessionMessage[], index: number): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The message at `index` is a notice of a part of Ta (TaMessageSource.notice) that had a turn cut short go on (moved
|
|
23
|
+
* to the cloud as it worked, a grant it waited for): a step of that turn, as a restart of Ta is, not a row of its own.
|
|
24
|
+
* The turn was cut short: its last answer was stopped or failed, or ended on its calls with no answer after them.
|
|
25
|
+
*/
|
|
26
|
+
function carried(messages: readonly SessionMessage[], index: number): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* A message of a package or of pi between a turn cut short and the notice that had it go on (the note of a move to
|
|
29
|
+
* the cloud, which the notice says, and the system prompt it goes on with): of that turn too, drawing nothing in it.
|
|
30
|
+
*/
|
|
31
|
+
function beforeCarried(messages: readonly SessionMessage[], index: number): boolean;
|
|
32
|
+
/** The note that Ta restarted in the middle of a run and went on with it (TaSessionResume). */
|
|
33
|
+
function resumed(message: SessionMessage): boolean;
|
|
34
|
+
/** The note that the network was back and it went on with the run the network stopped (TaNetworkResume). */
|
|
35
|
+
function resumedOnline(message: SessionMessage): boolean;
|
|
36
|
+
/** `message`, of the user, was written before `previous`, of the agent, came: while the agent worked. */
|
|
37
|
+
function writtenBefore(message: SessionMessage, previous: SessionMessage): boolean;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=turn-join.d.ts.map
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TurnJoin = exports.TURN_ROLES = void 0;
|
|
4
|
+
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
5
|
+
const message_1 = require("./message");
|
|
6
|
+
/** The roles of a turn of the agent: its answer, and the results of the tools it called. */
|
|
7
|
+
exports.TURN_ROLES = new Set(['assistant', 'toolResult']);
|
|
8
|
+
/**
|
|
9
|
+
* Which messages of the conversation belong to the same turn (the work between two asks of the user), as opposed to
|
|
10
|
+
* an ask of its own: what was said on the way while the agent worked, and what it goes on with after a turn stopped
|
|
11
|
+
* short. Over pi's messages, without changing them.
|
|
12
|
+
*/
|
|
13
|
+
var TurnJoin;
|
|
14
|
+
(function (TurnJoin) {
|
|
15
|
+
/**
|
|
16
|
+
* The message at `index`, of the user, steered a turn: it came after the result of a tool and was written before
|
|
17
|
+
* it, while the agent worked; pi gave it to the agent with the results, and the work went on. One after another
|
|
18
|
+
* that did (written at once) did too. A message of the user that steered is a step of its turn, not an ask.
|
|
19
|
+
*/
|
|
20
|
+
function steered(messages, index) {
|
|
21
|
+
var _a;
|
|
22
|
+
if (((_a = messages[index]) === null || _a === void 0 ? void 0 : _a.role) !== 'user') {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
for (let before = index - 1; before >= 0; before--) {
|
|
26
|
+
const { role } = messages[before];
|
|
27
|
+
if (role === 'user') {
|
|
28
|
+
return steered(messages, before);
|
|
29
|
+
}
|
|
30
|
+
if (exports.TURN_ROLES.has(role)) {
|
|
31
|
+
return role === 'toolResult' && writtenBefore(messages[index], messages[before]);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
TurnJoin.steered = steered;
|
|
37
|
+
/**
|
|
38
|
+
* The message at `index`, of the user, after a turn they stopped which said nothing more: it goes on in that turn as
|
|
39
|
+
* what was said on the way does, a step of it, rather than as an ask of a turn of its own.
|
|
40
|
+
*/
|
|
41
|
+
function afterStopped(messages, index) {
|
|
42
|
+
const message = messages[index];
|
|
43
|
+
if (message.role !== 'user') {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
// What they typed whole: a command has a line of its own, a message of a part of Ta is a bubble of its own (as it is
|
|
47
|
+
// said on the way), and pictures are not a line of words.
|
|
48
|
+
const blocks = message_1.MessageUtil.blocks(messages[index]);
|
|
49
|
+
const text = message_1.MessageUtil.text(blocks);
|
|
50
|
+
if (!text.trim() || /^[/!]/.test(text) || ta_protocol_1.TaMessageSource.of(text) || blocks.some(block => block.type !== 'text')) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
for (let before = index - 1; before >= 0; before--) {
|
|
54
|
+
const { role: was } = messages[before];
|
|
55
|
+
if (was === 'user') {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
if (was === 'assistant') {
|
|
59
|
+
return message_1.MessageUtil.stopReason(messages[before]) === 'aborted';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
TurnJoin.afterStopped = afterStopped;
|
|
65
|
+
/**
|
|
66
|
+
* The message at `index` is a notice of a part of Ta (TaMessageSource.notice) that had a turn cut short go on (moved
|
|
67
|
+
* to the cloud as it worked, a grant it waited for): a step of that turn, as a restart of Ta is, not a row of its own.
|
|
68
|
+
* The turn was cut short: its last answer was stopped or failed, or ended on its calls with no answer after them.
|
|
69
|
+
*/
|
|
70
|
+
function carried(messages, index) {
|
|
71
|
+
if (!ta_protocol_1.TaSaid.notice(messages[index])) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
for (let before = index - 1; before >= 0; before--) {
|
|
75
|
+
const message = messages[before];
|
|
76
|
+
if (message.role === 'toolResult') {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
if (message.role === 'assistant') {
|
|
80
|
+
return message.stopReason === 'aborted' || message.stopReason === 'error' || message.stopReason === 'toolUse';
|
|
81
|
+
}
|
|
82
|
+
if (message.role === 'user') {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
TurnJoin.carried = carried;
|
|
89
|
+
/**
|
|
90
|
+
* A message of a package or of pi between a turn cut short and the notice that had it go on (the note of a move to
|
|
91
|
+
* the cloud, which the notice says, and the system prompt it goes on with): of that turn too, drawing nothing in it.
|
|
92
|
+
*/
|
|
93
|
+
function beforeCarried(messages, index) {
|
|
94
|
+
for (let at = index; at < messages.length; at++) {
|
|
95
|
+
const { role } = messages[at];
|
|
96
|
+
if (role !== 'custom' && role !== 'system') {
|
|
97
|
+
return role === 'user' && carried(messages, at);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
TurnJoin.beforeCarried = beforeCarried;
|
|
103
|
+
/** The note that Ta restarted in the middle of a run and went on with it (TaSessionResume). */
|
|
104
|
+
function resumed(message) {
|
|
105
|
+
return message.customType === ta_protocol_1.TA_RESUME_MESSAGE;
|
|
106
|
+
}
|
|
107
|
+
TurnJoin.resumed = resumed;
|
|
108
|
+
/** The note that the network was back and it went on with the run the network stopped (TaNetworkResume). */
|
|
109
|
+
function resumedOnline(message) {
|
|
110
|
+
var _a;
|
|
111
|
+
return ((_a = message.details) === null || _a === void 0 ? void 0 : _a.reason) === 'network';
|
|
112
|
+
}
|
|
113
|
+
TurnJoin.resumedOnline = resumedOnline;
|
|
114
|
+
/** `message`, of the user, was written before `previous`, of the agent, came: while the agent worked. */
|
|
115
|
+
function writtenBefore(message, previous) {
|
|
116
|
+
const { role, timestamp } = message;
|
|
117
|
+
const { role: was, timestamp: at } = previous;
|
|
118
|
+
return role === 'user' && !!was && exports.TURN_ROLES.has(was) && typeof timestamp === 'number' && typeof at === 'number' && timestamp < at;
|
|
119
|
+
}
|
|
120
|
+
TurnJoin.writtenBefore = writtenBefore;
|
|
121
|
+
})(TurnJoin || (exports.TurnJoin = TurnJoin = {}));
|
|
122
|
+
//# sourceMappingURL=turn-join.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-web",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.50.0",
|
|
4
4
|
"description": "The web client of ta serve: sessions, streaming messages, tool runs with diffs, and dialogs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cell-component"
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@celljs/core": "4.
|
|
37
|
-
"@celljs/react": "4.
|
|
38
|
-
"@celljs/ta-client": "4.
|
|
39
|
-
"@celljs/ta-protocol": "4.
|
|
40
|
-
"@celljs/ta-relay": "4.
|
|
41
|
-
"@celljs/widget": "4.
|
|
36
|
+
"@celljs/core": "4.50.0",
|
|
37
|
+
"@celljs/react": "4.50.0",
|
|
38
|
+
"@celljs/ta-client": "4.50.0",
|
|
39
|
+
"@celljs/ta-protocol": "4.50.0",
|
|
40
|
+
"@celljs/ta-relay": "4.50.0",
|
|
41
|
+
"@celljs/widget": "4.50.0",
|
|
42
42
|
"@types/three": "^0.187.0",
|
|
43
43
|
"@xterm/addon-fit": "^0.11.0",
|
|
44
44
|
"@xterm/addon-unicode11": "^0.9.0",
|
|
Binary file
|