@celljs/ta-web 4.9.0 → 4.10.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 +4 -3
- package/README.md +4 -3
- package/esm/browser/assistant/assistant-chat-list.js +8 -2
- package/esm/browser/assistant/assistant-extension.d.ts +8 -1
- package/esm/browser/assistant/assistant-extension.js +33 -5
- package/esm/browser/assistant/assistant-protocol.d.ts +3 -1
- package/esm/browser/assistant/assistant-task-source.d.ts +2 -0
- package/esm/browser/assistant/assistant-task-source.js +2 -0
- package/esm/browser/assistant/assistant-task-util.d.ts +8 -0
- package/esm/browser/assistant/assistant-task-util.js +13 -3
- package/esm/browser/assistant/assistant-tasks.js +3 -2
- package/esm/browser/assistant/assistant-view.js +81 -56
- package/esm/browser/assistant/assistant.d.ts +30 -1
- package/esm/browser/assistant/assistant.js +89 -6
- package/esm/browser/assistant/task-views.d.ts +40 -6
- package/esm/browser/assistant/task-views.js +73 -21
- package/esm/browser/avatar/dino-avatar.d.ts +3 -4
- package/esm/browser/avatar/dino-avatar.js +4 -178
- package/esm/browser/avatar/dino-face.d.ts +19 -0
- package/esm/browser/avatar/dino-face.js +142 -0
- package/esm/browser/avatar/dino-geometry.d.ts +11 -0
- package/esm/browser/avatar/dino-geometry.js +38 -0
- package/esm/browser/avatar/dino-kinds.d.ts +15 -0
- package/esm/browser/avatar/dino-kinds.js +544 -0
- package/esm/browser/avatar/dino-motion.js +1 -1
- package/esm/browser/avatar/dino-shape.d.ts +80 -0
- package/esm/browser/avatar/dino-shape.js +113 -0
- package/esm/browser/avatar/dino-species.d.ts +1 -61
- package/esm/browser/avatar/dino-species.js +2 -653
- package/esm/browser/chat/chat-packages.d.ts +39 -0
- package/esm/browser/chat/chat-packages.js +70 -0
- package/esm/browser/chat/chat-protocol.d.ts +23 -1
- package/esm/browser/chat/chat-stores.d.ts +59 -0
- package/esm/browser/chat/chat-stores.js +121 -0
- package/esm/browser/chat/chat-util.d.ts +17 -0
- package/esm/browser/chat/chat-util.js +61 -0
- package/esm/browser/chat/chat-view.js +33 -12
- package/esm/browser/chat/chat.d.ts +31 -39
- package/esm/browser/chat/chat.js +226 -175
- package/esm/browser/components/access-view.js +1 -1
- package/esm/browser/components/account-menu.js +1 -1
- package/esm/browser/components/app-nav.d.ts +6 -3
- package/esm/browser/components/app-nav.js +19 -10
- package/esm/browser/components/app-shell-hooks.d.ts +47 -0
- package/esm/browser/components/app-shell-hooks.js +169 -0
- package/esm/browser/components/app-view.js +81 -172
- package/esm/browser/components/auth-view.js +1 -1
- package/esm/browser/components/chat-list.d.ts +20 -2
- package/esm/browser/components/chat-list.js +138 -22
- package/esm/browser/components/composer-box.d.ts +5 -5
- package/esm/browser/components/composer-box.js +111 -4
- package/esm/browser/components/composer.d.ts +7 -0
- package/esm/browser/components/composer.js +22 -14
- package/esm/browser/components/connection-bar.js +50 -17
- package/esm/browser/components/context-menu.d.ts +30 -4
- package/esm/browser/components/context-menu.js +199 -37
- package/esm/browser/components/conversation-scroll.d.ts +129 -6
- package/esm/browser/components/conversation-scroll.js +429 -109
- package/esm/browser/components/dino.js +1 -1
- package/esm/browser/components/earlier-messages.d.ts +2 -1
- package/esm/browser/components/earlier-messages.js +2 -17
- package/esm/browser/components/editor-area.d.ts +3 -1
- package/esm/browser/components/editor-area.js +6 -5
- package/esm/browser/components/empty-pictures.d.ts +0 -2
- package/esm/browser/components/empty-pictures.js +0 -16
- package/esm/browser/components/folder-picker.d.ts +5 -2
- package/esm/browser/components/folder-picker.js +30 -9
- package/esm/browser/components/held-talk.d.ts +28 -0
- package/esm/browser/components/held-talk.js +76 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/host-view.js +1 -1
- package/esm/browser/components/icon.d.ts +2 -2
- package/esm/browser/components/icon.js +5 -6
- package/esm/browser/components/image-viewer.d.ts +124 -0
- package/esm/browser/components/image-viewer.js +397 -0
- package/esm/browser/components/lightbox.d.ts +11 -0
- package/esm/browser/components/lightbox.js +24 -0
- package/esm/browser/components/markdown.d.ts +6 -2
- package/esm/browser/components/markdown.js +24 -10
- package/esm/browser/components/media.js +1 -10
- package/esm/browser/components/message-footer.d.ts +16 -2
- package/esm/browser/components/message-footer.js +29 -12
- package/esm/browser/components/message-list.d.ts +24 -3
- package/esm/browser/components/message-list.js +149 -20
- package/esm/browser/components/message-menu.d.ts +3 -1
- package/esm/browser/components/message-menu.js +18 -3
- package/esm/browser/components/nav-places.d.ts +16 -1
- package/esm/browser/components/nav-places.js +12 -3
- package/esm/browser/components/phone-shell.d.ts +4 -1
- package/esm/browser/components/phone-shell.js +3 -1
- package/esm/browser/components/run-status.js +3 -3
- package/esm/browser/components/select-bar.d.ts +9 -0
- package/esm/browser/components/select-bar.js +24 -0
- package/esm/browser/components/session-settings.d.ts +6 -0
- package/esm/browser/components/session-settings.js +14 -1
- package/esm/browser/components/session-view.js +8 -4
- package/esm/browser/components/settings-choices.d.ts +35 -0
- package/esm/browser/components/settings-choices.js +117 -0
- package/esm/browser/components/settings-parts.d.ts +21 -0
- package/esm/browser/components/settings-parts.js +323 -0
- package/esm/browser/components/settings-view.d.ts +0 -6
- package/esm/browser/components/settings-view.js +4 -406
- package/esm/browser/components/swipe-row.d.ts +2 -2
- package/esm/browser/components/swipe-row.js +7 -3
- package/esm/browser/components/tool-view.js +14 -12
- package/esm/browser/components/voice-button.d.ts +1 -1
- package/esm/browser/components/voice-button.js +1 -1
- package/esm/browser/components/voice-talk.d.ts +43 -0
- package/esm/browser/components/voice-talk.js +222 -0
- package/esm/browser/components/workbench-view.js +1 -1
- package/esm/browser/device/device.d.ts +3 -0
- package/esm/browser/device/device.js +11 -1
- package/esm/browser/device/hold.d.ts +42 -0
- package/esm/browser/device/hold.js +136 -0
- package/esm/browser/device/launch-screen.d.ts +1 -1
- package/esm/browser/device/launch-screen.js +1 -1
- package/esm/browser/device/long-press.d.ts +2 -0
- package/esm/browser/device/long-press.js +16 -1
- package/esm/browser/device/pull-down.d.ts +4 -2
- package/esm/browser/device/pull-down.js +64 -76
- package/esm/browser/device/row-swipe.d.ts +35 -10
- package/esm/browser/device/row-swipe.js +149 -71
- package/esm/browser/device/shake-undo.d.ts +16 -0
- package/esm/browser/device/shake-undo.js +59 -0
- package/esm/browser/device/sheet-swipe.d.ts +118 -18
- package/esm/browser/device/sheet-swipe.js +406 -107
- package/esm/browser/extension/icons.js +2 -1
- package/esm/browser/extension/web-extension-api.d.ts +135 -2
- package/esm/browser/extension/web-extension-code.d.ts +6 -0
- package/esm/browser/extension/web-extension-code.js +24 -0
- package/esm/browser/extension/web-extension-protocol.d.ts +23 -1
- package/esm/browser/extension/web-extension-protocol.js +8 -0
- package/esm/browser/extension/web-extensions.d.ts +14 -1
- package/esm/browser/extension/web-extensions.js +128 -24
- package/esm/browser/extension/web-tasks.d.ts +9 -1
- package/esm/browser/extension/web-tasks.js +24 -0
- package/esm/browser/files/files-protocol.d.ts +25 -0
- package/esm/browser/files/files-protocol.js +2 -0
- package/esm/browser/files/files.d.ts +35 -0
- package/esm/browser/files/files.js +119 -0
- package/esm/browser/hooks.d.ts +3 -1
- package/esm/browser/hooks.js +8 -0
- package/esm/browser/i18n/locales.d.ts +29 -2
- package/esm/browser/i18n/messages.d.ts +28 -1
- package/esm/browser/i18n/messages.js +58 -4
- package/esm/browser/index.d.ts +6 -0
- package/esm/browser/index.js +6 -0
- package/esm/browser/notices/notices-protocol.d.ts +9 -1
- package/esm/browser/notices/notices.d.ts +2 -0
- package/esm/browser/notices/notices.js +20 -10
- package/esm/browser/offline/device-values.d.ts +55 -0
- package/esm/browser/offline/device-values.js +142 -0
- package/esm/browser/offline/kept-chats-protocol.d.ts +17 -0
- package/esm/browser/offline/kept-chats-protocol.js +2 -0
- package/esm/browser/offline/kept-chats.d.ts +47 -0
- package/esm/browser/offline/kept-chats.js +146 -0
- package/esm/browser/offline/offline-reads.d.ts +44 -0
- package/esm/browser/offline/offline-reads.js +107 -0
- package/esm/browser/settings/settings-protocol.d.ts +2 -0
- package/esm/browser/settings/settings-protocol.js +2 -0
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +57 -17
- package/esm/browser/style/device.js +43 -4
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +67 -15
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +2 -1
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +47 -3
- package/esm/browser/style/tasks.d.ts +1 -1
- package/esm/browser/style/tasks.js +2 -0
- package/esm/browser/util/frame.d.ts +5 -4
- package/esm/browser/util/frame.js +5 -4
- package/esm/browser/util/markdown.d.ts +18 -1
- package/esm/browser/util/markdown.js +119 -5
- package/esm/browser/util/process.d.ts +21 -0
- package/esm/browser/util/process.js +45 -1
- package/esm/browser/util/voice.d.ts +5 -2
- package/esm/browser/util/voice.js +6 -3
- package/esm/browser/util/zoom.d.ts +46 -0
- package/esm/browser/util/zoom.js +96 -0
- package/esm/browser/workbench-calls.d.ts +59 -0
- package/esm/browser/workbench-calls.js +141 -0
- package/esm/browser/workbench-protocol.d.ts +5 -1
- package/esm/browser/workbench-util.d.ts +68 -0
- package/esm/browser/workbench-util.js +145 -0
- package/esm/browser/workbench.d.ts +15 -42
- package/esm/browser/workbench.js +53 -167
- package/lib/browser/assistant/assistant-chat-list.js +8 -2
- package/lib/browser/assistant/assistant-extension.d.ts +8 -1
- package/lib/browser/assistant/assistant-extension.js +33 -5
- package/lib/browser/assistant/assistant-protocol.d.ts +3 -1
- package/lib/browser/assistant/assistant-task-source.d.ts +2 -0
- package/lib/browser/assistant/assistant-task-source.js +2 -0
- package/lib/browser/assistant/assistant-task-util.d.ts +8 -0
- package/lib/browser/assistant/assistant-task-util.js +13 -3
- package/lib/browser/assistant/assistant-tasks.js +2 -1
- package/lib/browser/assistant/assistant-view.js +78 -53
- package/lib/browser/assistant/assistant.d.ts +30 -1
- package/lib/browser/assistant/assistant.js +89 -6
- package/lib/browser/assistant/task-views.d.ts +40 -6
- package/lib/browser/assistant/task-views.js +74 -21
- package/lib/browser/avatar/dino-avatar.d.ts +3 -4
- package/lib/browser/avatar/dino-avatar.js +27 -202
- package/lib/browser/avatar/dino-face.d.ts +20 -0
- package/lib/browser/avatar/dino-face.js +148 -0
- package/lib/browser/avatar/dino-geometry.d.ts +12 -0
- package/lib/browser/avatar/dino-geometry.js +47 -0
- package/lib/browser/avatar/dino-kinds.d.ts +16 -0
- package/lib/browser/avatar/dino-kinds.js +547 -0
- package/lib/browser/avatar/dino-motion.js +2 -2
- package/lib/browser/avatar/dino-shape.d.ts +81 -0
- package/lib/browser/avatar/dino-shape.js +126 -0
- package/lib/browser/avatar/dino-species.d.ts +1 -61
- package/lib/browser/avatar/dino-species.js +34 -687
- package/lib/browser/chat/chat-packages.d.ts +40 -0
- package/lib/browser/chat/chat-packages.js +74 -0
- package/lib/browser/chat/chat-protocol.d.ts +23 -1
- package/lib/browser/chat/chat-stores.d.ts +60 -0
- package/lib/browser/chat/chat-stores.js +125 -0
- package/lib/browser/chat/chat-util.d.ts +18 -0
- package/lib/browser/chat/chat-util.js +64 -0
- package/lib/browser/chat/chat-view.js +33 -12
- package/lib/browser/chat/chat.d.ts +31 -39
- package/lib/browser/chat/chat.js +227 -176
- package/lib/browser/components/access-view.js +2 -2
- package/lib/browser/components/account-menu.js +2 -2
- package/lib/browser/components/app-nav.d.ts +6 -3
- package/lib/browser/components/app-nav.js +17 -8
- package/lib/browser/components/app-shell-hooks.d.ts +48 -0
- package/lib/browser/components/app-shell-hooks.js +211 -0
- package/lib/browser/components/app-view.js +89 -180
- package/lib/browser/components/auth-view.js +3 -3
- package/lib/browser/components/chat-list.d.ts +20 -2
- package/lib/browser/components/chat-list.js +137 -21
- package/lib/browser/components/composer-box.d.ts +5 -5
- package/lib/browser/components/composer-box.js +111 -4
- package/lib/browser/components/composer.d.ts +7 -0
- package/lib/browser/components/composer.js +22 -14
- package/lib/browser/components/connection-bar.js +48 -15
- package/lib/browser/components/context-menu.d.ts +30 -4
- package/lib/browser/components/context-menu.js +198 -36
- package/lib/browser/components/conversation-scroll.d.ts +129 -6
- package/lib/browser/components/conversation-scroll.js +431 -110
- package/lib/browser/components/dino.js +3 -3
- package/lib/browser/components/earlier-messages.d.ts +2 -1
- package/lib/browser/components/earlier-messages.js +2 -17
- package/lib/browser/components/editor-area.d.ts +3 -1
- package/lib/browser/components/editor-area.js +5 -4
- package/lib/browser/components/empty-pictures.d.ts +0 -2
- package/lib/browser/components/empty-pictures.js +0 -17
- package/lib/browser/components/folder-picker.d.ts +5 -2
- package/lib/browser/components/folder-picker.js +30 -9
- package/lib/browser/components/held-talk.d.ts +29 -0
- package/lib/browser/components/held-talk.js +79 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/host-view.js +5 -5
- package/lib/browser/components/icon.d.ts +2 -2
- package/lib/browser/components/icon.js +7 -6
- package/lib/browser/components/image-viewer.d.ts +125 -0
- package/lib/browser/components/image-viewer.js +435 -0
- package/lib/browser/components/lightbox.d.ts +12 -0
- package/lib/browser/components/lightbox.js +60 -0
- package/lib/browser/components/markdown.d.ts +6 -2
- package/lib/browser/components/markdown.js +24 -10
- package/lib/browser/components/media.js +2 -11
- package/lib/browser/components/message-footer.d.ts +16 -2
- package/lib/browser/components/message-footer.js +31 -12
- package/lib/browser/components/message-list.d.ts +24 -3
- package/lib/browser/components/message-list.js +146 -16
- package/lib/browser/components/message-menu.d.ts +3 -1
- package/lib/browser/components/message-menu.js +17 -2
- package/lib/browser/components/nav-places.d.ts +16 -1
- package/lib/browser/components/nav-places.js +13 -3
- package/lib/browser/components/phone-shell.d.ts +4 -1
- package/lib/browser/components/phone-shell.js +3 -1
- package/lib/browser/components/run-status.js +3 -3
- package/lib/browser/components/select-bar.d.ts +10 -0
- package/lib/browser/components/select-bar.js +61 -0
- package/lib/browser/components/session-settings.d.ts +6 -0
- package/lib/browser/components/session-settings.js +14 -1
- package/lib/browser/components/session-view.js +7 -3
- package/lib/browser/components/settings-choices.d.ts +36 -0
- package/lib/browser/components/settings-choices.js +156 -0
- package/lib/browser/components/settings-parts.d.ts +22 -0
- package/lib/browser/components/settings-parts.js +359 -0
- package/lib/browser/components/settings-view.d.ts +0 -6
- package/lib/browser/components/settings-view.js +2 -405
- package/lib/browser/components/swipe-row.d.ts +2 -2
- package/lib/browser/components/swipe-row.js +7 -3
- package/lib/browser/components/tool-view.js +14 -12
- package/lib/browser/components/voice-button.d.ts +1 -1
- package/lib/browser/components/voice-button.js +1 -1
- package/lib/browser/components/voice-talk.d.ts +44 -0
- package/lib/browser/components/voice-talk.js +260 -0
- package/lib/browser/components/workbench-view.js +3 -3
- package/lib/browser/device/device.d.ts +3 -0
- package/lib/browser/device/device.js +11 -1
- package/lib/browser/device/hold.d.ts +43 -0
- package/lib/browser/device/hold.js +173 -0
- package/lib/browser/device/launch-screen.d.ts +1 -1
- package/lib/browser/device/launch-screen.js +1 -1
- package/lib/browser/device/long-press.d.ts +2 -0
- package/lib/browser/device/long-press.js +16 -1
- package/lib/browser/device/pull-down.d.ts +4 -2
- package/lib/browser/device/pull-down.js +63 -75
- package/lib/browser/device/row-swipe.d.ts +35 -10
- package/lib/browser/device/row-swipe.js +148 -70
- package/lib/browser/device/shake-undo.d.ts +17 -0
- package/lib/browser/device/shake-undo.js +63 -0
- package/lib/browser/device/sheet-swipe.d.ts +118 -18
- package/lib/browser/device/sheet-swipe.js +410 -108
- package/lib/browser/extension/icons.js +1 -0
- package/lib/browser/extension/web-extension-api.d.ts +135 -2
- package/lib/browser/extension/web-extension-code.d.ts +6 -0
- package/lib/browser/extension/web-extension-code.js +24 -0
- package/lib/browser/extension/web-extension-protocol.d.ts +23 -1
- package/lib/browser/extension/web-extension-protocol.js +9 -1
- package/lib/browser/extension/web-extensions.d.ts +14 -1
- package/lib/browser/extension/web-extensions.js +125 -21
- package/lib/browser/extension/web-tasks.d.ts +9 -1
- package/lib/browser/extension/web-tasks.js +24 -0
- package/lib/browser/files/files-protocol.d.ts +26 -0
- package/lib/browser/files/files-protocol.js +5 -0
- package/lib/browser/files/files.d.ts +36 -0
- package/lib/browser/files/files.js +122 -0
- package/lib/browser/hooks.d.ts +3 -1
- package/lib/browser/hooks.js +9 -0
- package/lib/browser/i18n/locales.d.ts +29 -2
- package/lib/browser/i18n/messages.d.ts +28 -1
- package/lib/browser/i18n/messages.js +58 -4
- package/lib/browser/index.d.ts +6 -0
- package/lib/browser/index.js +6 -0
- package/lib/browser/notices/notices-protocol.d.ts +9 -1
- package/lib/browser/notices/notices.d.ts +2 -0
- package/lib/browser/notices/notices.js +20 -10
- package/lib/browser/offline/device-values.d.ts +56 -0
- package/lib/browser/offline/device-values.js +148 -0
- package/lib/browser/offline/kept-chats-protocol.d.ts +18 -0
- package/lib/browser/offline/kept-chats-protocol.js +5 -0
- package/lib/browser/offline/kept-chats.d.ts +48 -0
- package/lib/browser/offline/kept-chats.js +149 -0
- package/lib/browser/offline/offline-reads.d.ts +45 -0
- package/lib/browser/offline/offline-reads.js +111 -0
- package/lib/browser/settings/settings-protocol.d.ts +2 -0
- package/lib/browser/settings/settings-protocol.js +2 -0
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +57 -17
- package/lib/browser/style/device.js +43 -4
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +67 -15
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +2 -1
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +47 -3
- package/lib/browser/style/tasks.d.ts +1 -1
- package/lib/browser/style/tasks.js +2 -0
- package/lib/browser/util/frame.d.ts +5 -4
- package/lib/browser/util/frame.js +5 -4
- package/lib/browser/util/markdown.d.ts +18 -1
- package/lib/browser/util/markdown.js +119 -5
- package/lib/browser/util/process.d.ts +21 -0
- package/lib/browser/util/process.js +46 -2
- package/lib/browser/util/voice.d.ts +5 -2
- package/lib/browser/util/voice.js +6 -3
- package/lib/browser/util/zoom.d.ts +47 -0
- package/lib/browser/util/zoom.js +99 -0
- package/lib/browser/workbench-calls.d.ts +60 -0
- package/lib/browser/workbench-calls.js +145 -0
- package/lib/browser/workbench-protocol.d.ts +5 -1
- package/lib/browser/workbench-util.d.ts +69 -0
- package/lib/browser/workbench-util.js +151 -0
- package/lib/browser/workbench.d.ts +15 -42
- package/lib/browser/workbench.js +74 -189
- package/package.json +10 -10
- package/public/launch.svg +46 -42
|
@@ -6,13 +6,32 @@ import { MessageUtil, type ToolOutput } from '../util/message.js';
|
|
|
6
6
|
import { type ProcessStep, type ThreadItem } from '../util/process.js';
|
|
7
7
|
/** The session of the conversation: who answers in it may be drawn by the extension of its group. */
|
|
8
8
|
export declare const ConversationSession: React.Context<TaSessionInfo | undefined>;
|
|
9
|
+
/** What can be done with a message sent from here that failed to go. */
|
|
10
|
+
export interface OutboxActions {
|
|
11
|
+
resend(id: string): void;
|
|
12
|
+
discard(id: string): void;
|
|
13
|
+
}
|
|
9
14
|
/** Who answers, at the head of a turn: ta, or the avatar the extension of the session's group draws. */
|
|
10
15
|
export declare function TurnAvatar({ mood }: {
|
|
11
16
|
mood: Mood;
|
|
12
17
|
}): React.JSX.Element;
|
|
13
|
-
|
|
18
|
+
type Blocks = ReturnType<typeof MessageUtil.blocks>;
|
|
19
|
+
/**
|
|
20
|
+
* The images of a message of the user: one keeps its own shape at the size of a bubble, a few stand as
|
|
21
|
+
* squares of one size, and a click on any of them opens it full size over the page.
|
|
22
|
+
*/
|
|
14
23
|
export declare function UserImages({ blocks }: {
|
|
15
|
-
blocks:
|
|
24
|
+
blocks: Blocks;
|
|
25
|
+
}): React.JSX.Element | null;
|
|
26
|
+
/**
|
|
27
|
+
* What the user said, in the bubble of a message of theirs, with the pictures they sent with it in the same
|
|
28
|
+
* bubble: the pictures first, the words under them. A message of pictures alone has no bubble of its own.
|
|
29
|
+
* `bubble` is the class of that bubble, which a conversation and the double have of their own.
|
|
30
|
+
*/
|
|
31
|
+
export declare function UserSaid({ blocks, text, bubble }: {
|
|
32
|
+
blocks: Blocks;
|
|
33
|
+
text: string;
|
|
34
|
+
bubble?: string;
|
|
16
35
|
}): React.JSX.Element | null;
|
|
17
36
|
/**
|
|
18
37
|
* The head of a turn and its work: the work in one line, "N steps", open while ta is at it, then folded,
|
|
@@ -32,6 +51,8 @@ export declare function Process({ steps, active, results, tools, leading, status
|
|
|
32
51
|
/** A turn that has shown nothing yet: what ta does goes on its head. */
|
|
33
52
|
export declare function quiet(item: ThreadItem | undefined): boolean;
|
|
34
53
|
/** The conversation; tool results show with the calls they answer. */
|
|
35
|
-
export declare function MessageList({ state }: {
|
|
54
|
+
export declare function MessageList({ state, outbox }: {
|
|
36
55
|
state: SessionState;
|
|
56
|
+
outbox?: OutboxActions;
|
|
37
57
|
}): React.JSX.Element;
|
|
58
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TaMessageContext, TaSkillUse } from '@celljs/ta-protocol';
|
|
2
|
-
import { ChevronRight, Sparkles } from 'lucide-react';
|
|
1
|
+
import { TaImageNote, TaMessageContext, TaSkillUse } from '@celljs/ta-protocol';
|
|
2
|
+
import { ChevronRight, CircleAlert, Sparkles } from 'lucide-react';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { CustomMessage, ExtensionBoundary, SessionAvatars } from '../extension/extension-view.js';
|
|
4
|
+
import { CustomMessage, ExtensionBoundary, MessageRenderers, SessionAvatars } from '../extension/extension-view.js';
|
|
5
5
|
import { useT } from '../i18n/use-t.js';
|
|
6
6
|
import { MessageUtil } from '../util/message.js';
|
|
7
7
|
import { ProcessUtil } from '../util/process.js';
|
|
@@ -9,14 +9,27 @@ import { ToolUtil } from '../util/tool.js';
|
|
|
9
9
|
import { Callout } from './callout.js';
|
|
10
10
|
import { ASK_CLASS } from './conversation-scroll.js';
|
|
11
11
|
import { Icon } from './icon.js';
|
|
12
|
+
import { Lightbox } from './lightbox.js';
|
|
12
13
|
import { Markdown } from './markdown.js';
|
|
13
|
-
import { TurnFooter, UserFooter } from './message-footer.js';
|
|
14
|
+
import { TimeBreak, TurnFooter, UserFooter } from './message-footer.js';
|
|
14
15
|
import { useMessageMenu } from './message-menu.js';
|
|
15
16
|
import { RunStatus } from './run-status.js';
|
|
16
17
|
import { TaAvatar } from './ta-avatar.js';
|
|
17
18
|
import { ToolView } from './tool-view.js';
|
|
18
19
|
/** The session of the conversation: who answers in it may be drawn by the extension of its group. */
|
|
19
20
|
export const ConversationSession = React.createContext(undefined);
|
|
21
|
+
/** The messages of the conversation still on their way from here, by message, with what can be done with those that failed. */
|
|
22
|
+
const Outbox = React.createContext({ of: new Map() });
|
|
23
|
+
/** A message that did not go: marked as such, with a way to send it again or take it back, as in a messenger. */
|
|
24
|
+
function SendFailed({ sent, actions }) {
|
|
25
|
+
const t = useT();
|
|
26
|
+
return (React.createElement("div", { className: "ta-send-failed", title: sent.failed },
|
|
27
|
+
React.createElement(Icon, { icon: CircleAlert, size: 14 }),
|
|
28
|
+
React.createElement("span", null, t('ta.message.sendFailed')),
|
|
29
|
+
actions && (React.createElement(React.Fragment, null,
|
|
30
|
+
React.createElement("button", { type: "button", className: "ta-link-button", onClick: () => actions.resend(sent.id) }, t('ta.message.resend')),
|
|
31
|
+
React.createElement("button", { type: "button", className: "ta-link-button", onClick: () => actions.discard(sent.id) }, t('ta.message.discard'))))));
|
|
32
|
+
}
|
|
20
33
|
/** Who answers, at the head of a turn: ta, or the avatar the extension of the session's group draws. */
|
|
21
34
|
export function TurnAvatar({ mood }) {
|
|
22
35
|
var _a;
|
|
@@ -41,10 +54,39 @@ function TaskUpdate({ title, status, result }) {
|
|
|
41
54
|
t(`ta.task.${status}`)),
|
|
42
55
|
React.createElement(Markdown, { text: result })));
|
|
43
56
|
}
|
|
44
|
-
/** The images of a message
|
|
57
|
+
/** The images of a message: those the page can show. */
|
|
58
|
+
function imagesOf(blocks) {
|
|
59
|
+
return blocks.filter(block => { var _a; return block.type === 'image' && block.data && ((_a = block.mimeType) === null || _a === void 0 ? void 0 : _a.startsWith('image/')); });
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The images of a message of the user: one keeps its own shape at the size of a bubble, a few stand as
|
|
63
|
+
* squares of one size, and a click on any of them opens it full size over the page.
|
|
64
|
+
*/
|
|
45
65
|
export function UserImages({ blocks }) {
|
|
46
|
-
const
|
|
47
|
-
|
|
66
|
+
const t = useT();
|
|
67
|
+
const [open, setOpen] = React.useState();
|
|
68
|
+
const images = imagesOf(blocks);
|
|
69
|
+
if (images.length === 0) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
const src = (block) => `data:${block.mimeType};base64,${block.data}`;
|
|
73
|
+
return (React.createElement("div", { className: "ta-user-images", "data-count": Math.min(images.length, 3) },
|
|
74
|
+
images.map((block, index) => (React.createElement("button", { key: index, type: "button", className: "ta-user-image", title: t('ta.markdown.enlarge'), onClick: () => setOpen(index) },
|
|
75
|
+
React.createElement("img", { className: "ta-thumb", src: src(block), alt: "" })))),
|
|
76
|
+
open !== undefined && images[open] && React.createElement(Lightbox, { src: src(images[open]), alt: "", onClose: () => setOpen(undefined) })));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* What the user said, in the bubble of a message of theirs, with the pictures they sent with it in the same
|
|
80
|
+
* bubble: the pictures first, the words under them. A message of pictures alone has no bubble of its own.
|
|
81
|
+
* `bubble` is the class of that bubble, which a conversation and the double have of their own.
|
|
82
|
+
*/
|
|
83
|
+
export function UserSaid({ blocks, text, bubble = 'ta-bubble' }) {
|
|
84
|
+
if (imagesOf(blocks).length === 0) {
|
|
85
|
+
return text ? React.createElement("div", { className: bubble }, text) : null;
|
|
86
|
+
}
|
|
87
|
+
return (React.createElement("div", { className: `${bubble} ta-bubble-media${text ? '' : ' ta-bubble-bare'}` },
|
|
88
|
+
React.createElement(UserImages, { blocks: blocks }),
|
|
89
|
+
text && React.createElement("div", { className: "ta-bubble-text" }, text)));
|
|
48
90
|
}
|
|
49
91
|
function UserMessage({ message }) {
|
|
50
92
|
var _a;
|
|
@@ -53,7 +95,7 @@ function UserMessage({ message }) {
|
|
|
53
95
|
if (update) {
|
|
54
96
|
return React.createElement(TaskUpdate, { title: update[1], status: update[2], result: update[3] });
|
|
55
97
|
}
|
|
56
|
-
const said = TaMessageContext.strip(MessageUtil.text(blocks));
|
|
98
|
+
const said = TaImageNote.strip(TaMessageContext.strip(MessageUtil.text(blocks)));
|
|
57
99
|
const skill = TaSkillUse.parse(said);
|
|
58
100
|
if (skill) {
|
|
59
101
|
return React.createElement(UserBubble, { message: message, blocks: blocks, text: (_a = skill.message) !== null && _a !== void 0 ? _a : '', copied: TaSkillUse.command(skill), skill: skill });
|
|
@@ -77,10 +119,17 @@ function SkillUse({ skill }) {
|
|
|
77
119
|
}
|
|
78
120
|
function UserBubble({ message, blocks, text, copied, skill, }) {
|
|
79
121
|
const [menu, onContextMenu] = useMessageMenu({ kind: 'user', message, text: copied });
|
|
122
|
+
const outbox = React.useContext(Outbox);
|
|
123
|
+
const sent = outbox.of.get(message);
|
|
124
|
+
if (sent) {
|
|
125
|
+
// Not in the session yet: nothing to branch from or rewind to.
|
|
126
|
+
return (React.createElement("div", { className: `ta-message ta-user ${sent.failed ? 'ta-user-failed' : 'ta-user-sending'}` },
|
|
127
|
+
React.createElement(UserSaid, { blocks: blocks, text: text }),
|
|
128
|
+
sent.failed ? React.createElement(SendFailed, { sent: sent, actions: outbox.actions }) : React.createElement("div", { className: "ta-footer" })));
|
|
129
|
+
}
|
|
80
130
|
return (React.createElement("div", { className: "ta-message ta-user", onContextMenu: onContextMenu },
|
|
81
|
-
React.createElement(UserImages, { blocks: blocks }),
|
|
82
131
|
skill && React.createElement(SkillUse, { skill: skill }),
|
|
83
|
-
|
|
132
|
+
React.createElement(UserSaid, { blocks: blocks, text: text }),
|
|
84
133
|
React.createElement(UserFooter, { message: message, text: copied }),
|
|
85
134
|
menu));
|
|
86
135
|
}
|
|
@@ -95,6 +144,17 @@ const ThinkingStep = React.memo(function ThinkingStep({ text, tagged = true }) {
|
|
|
95
144
|
!open && React.createElement("span", { className: "ta-step-preview" }, ProcessUtil.preview(text))),
|
|
96
145
|
open && React.createElement("div", { className: "ta-thinking-text" }, text)));
|
|
97
146
|
});
|
|
147
|
+
/** The summary an agent compacted its context to: folded into one line, it opens to the whole summary. */
|
|
148
|
+
const SummaryStep = React.memo(function SummaryStep({ text }) {
|
|
149
|
+
const t = useT();
|
|
150
|
+
const [open, setOpen] = React.useState(false);
|
|
151
|
+
return (React.createElement("div", { className: "ta-step-summary" },
|
|
152
|
+
React.createElement("button", { type: "button", className: "ta-step-toggle", "aria-expanded": open, onClick: () => setOpen(!open) },
|
|
153
|
+
React.createElement("span", { className: "ta-status ta-status-thought" }),
|
|
154
|
+
React.createElement("span", { className: "ta-step-tag" }, t('ta.message.compacted')),
|
|
155
|
+
React.createElement(Icon, { icon: ChevronRight, size: 14, className: "ta-step-chevron" })),
|
|
156
|
+
open && React.createElement("div", { className: "ta-thinking-text" }, text)));
|
|
157
|
+
});
|
|
98
158
|
const TextStep = React.memo(function TextStep({ text }) {
|
|
99
159
|
return (React.createElement("div", { className: "ta-step-text" },
|
|
100
160
|
React.createElement("span", { className: "ta-status ta-status-thought" }),
|
|
@@ -107,12 +167,68 @@ function Step({ step, results, tools, tagged }) {
|
|
|
107
167
|
return React.createElement(ThinkingStep, { text: step.text, tagged: tagged });
|
|
108
168
|
case 'text':
|
|
109
169
|
return React.createElement(TextStep, { text: step.text });
|
|
170
|
+
case 'summary':
|
|
171
|
+
return React.createElement(SummaryStep, { text: step.text });
|
|
110
172
|
default: {
|
|
111
173
|
const { id = '', name = '', arguments: args } = step.call;
|
|
112
174
|
return (React.createElement(ToolView, { id: id, name: name, args: (_a = args) !== null && _a !== void 0 ? _a : {}, run: id ? tools[id] : undefined, message: id ? results.get(id) : undefined, runs: tools }));
|
|
113
175
|
}
|
|
114
176
|
}
|
|
115
177
|
}
|
|
178
|
+
/** How long the steps of a turn take to fold or open, and how. */
|
|
179
|
+
const FOLD_MS = 220;
|
|
180
|
+
const FOLD_EASE = 'cubic-bezier(0.2, 0.8, 0.2, 1)';
|
|
181
|
+
/**
|
|
182
|
+
* Whether the steps of `ref` are in the page: they fold and open in a motion, so that what is under them
|
|
183
|
+
* slides to its place rather than jumps there (as when a turn ends and its steps fold under the eyes of
|
|
184
|
+
* the user). While they fold they stay; without motion they come and go at once. `slideOpen`: they open in
|
|
185
|
+
* a motion too (opened by the user); steps that come while ta works come in as steps do, without it.
|
|
186
|
+
*/
|
|
187
|
+
function useFold(open, ref, slideOpen) {
|
|
188
|
+
const [closing, setClosing] = React.useState(false);
|
|
189
|
+
const [was, setWas] = React.useState(open);
|
|
190
|
+
if (was !== open) {
|
|
191
|
+
setWas(open);
|
|
192
|
+
setClosing(!open);
|
|
193
|
+
}
|
|
194
|
+
const opened = React.useRef(open);
|
|
195
|
+
React.useLayoutEffect(() => {
|
|
196
|
+
const opening = open && !opened.current && slideOpen;
|
|
197
|
+
opened.current = open;
|
|
198
|
+
const element = ref.current;
|
|
199
|
+
if (!opening && !closing) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (!element || typeof element.animate !== 'function' || document.documentElement.hasAttribute('data-reduce-motion')) {
|
|
203
|
+
setClosing(false);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const style = getComputedStyle(element);
|
|
207
|
+
const full = {
|
|
208
|
+
height: `${element.offsetHeight}px`,
|
|
209
|
+
paddingTop: style.paddingTop,
|
|
210
|
+
paddingBottom: style.paddingBottom,
|
|
211
|
+
marginTop: style.marginTop,
|
|
212
|
+
marginBottom: style.marginBottom,
|
|
213
|
+
opacity: 1,
|
|
214
|
+
};
|
|
215
|
+
const none = { height: '0px', paddingTop: '0px', paddingBottom: '0px', marginTop: '0px', marginBottom: '0px', opacity: 0 };
|
|
216
|
+
element.style.overflow = 'hidden';
|
|
217
|
+
// Folded, the steps stay at no height until they go: not drawn whole again for the frame before.
|
|
218
|
+
const animation = element.animate(opening ? [none, full] : [full, none], { duration: FOLD_MS, easing: FOLD_EASE, fill: opening ? 'none' : 'forwards' });
|
|
219
|
+
animation.onfinish = () => {
|
|
220
|
+
element.style.overflow = '';
|
|
221
|
+
if (!opening) {
|
|
222
|
+
setClosing(false);
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
return () => {
|
|
226
|
+
animation.cancel();
|
|
227
|
+
element.style.overflow = '';
|
|
228
|
+
};
|
|
229
|
+
}, [open, closing, ref, slideOpen]);
|
|
230
|
+
return open || closing;
|
|
231
|
+
}
|
|
116
232
|
/**
|
|
117
233
|
* The head of a turn and its work: the work in one line, "N steps", open while ta is at it, then folded,
|
|
118
234
|
* so that a long conversation reads as what was asked and what came of it. Before the first step the
|
|
@@ -123,9 +239,11 @@ export function Process({ steps, active, results, tools, leading, status, }) {
|
|
|
123
239
|
const [manual, setManual] = React.useState();
|
|
124
240
|
const [showAll, setShowAll] = React.useState(false);
|
|
125
241
|
const id = React.useId();
|
|
242
|
+
const stepsRef = React.useRef(null);
|
|
126
243
|
const { steps: count, failed } = ToolUtil.count(ProcessUtil.tools(steps), results, tools);
|
|
127
244
|
// Open while it works, then folded; a failed step says so on the head, quietly.
|
|
128
245
|
const open = manual !== null && manual !== void 0 ? manual : active;
|
|
246
|
+
const shown = useFold(open && steps.length > 0, stepsRef, !active);
|
|
129
247
|
const folded = ProcessUtil.fold(steps, active, showAll);
|
|
130
248
|
// Only thoughts: the head already says so, the steps need not say it again.
|
|
131
249
|
const thoughtOnly = steps.every(step => step.kind === 'thinking');
|
|
@@ -139,7 +257,7 @@ export function Process({ steps, active, results, tools, leading, status, }) {
|
|
|
139
257
|
"\u00B7 ",
|
|
140
258
|
t('ta.process.failed', { count: failed })),
|
|
141
259
|
React.createElement(Icon, { icon: ChevronRight, size: 14, className: "ta-process-chevron" }))) : (status)),
|
|
142
|
-
|
|
260
|
+
shown && (React.createElement("div", { id: id, ref: stepsRef, className: "ta-process-steps" },
|
|
143
261
|
folded.hidden > 0 && (React.createElement("button", { type: "button", className: "ta-link ta-more", onClick: () => setShowAll(true) }, t('ta.process.earlier', { count: folded.hidden }))),
|
|
144
262
|
folded.steps.map(step => (React.createElement(Step, { key: step.key, step: step, results: results, tools: tools, tagged: !thoughtOnly })))))));
|
|
145
263
|
}
|
|
@@ -147,7 +265,7 @@ export function Process({ steps, active, results, tools, leading, status, }) {
|
|
|
147
265
|
export function quiet(item) {
|
|
148
266
|
return (item === null || item === void 0 ? void 0 : item.kind) === 'turn' && item.active && !item.steps.length && !item.reply.some(text => text.trim());
|
|
149
267
|
}
|
|
150
|
-
function Turn({ item, tools, mood, status }) {
|
|
268
|
+
function Turn({ item, tools, mood, status, latest, }) {
|
|
151
269
|
var _a;
|
|
152
270
|
const t = useT();
|
|
153
271
|
const session = React.useContext(ConversationSession);
|
|
@@ -155,13 +273,19 @@ function Turn({ item, tools, mood, status }) {
|
|
|
155
273
|
const { errorMessage } = ((_a = item.last) !== null && _a !== void 0 ? _a : {});
|
|
156
274
|
const stopReason = MessageUtil.stopReason(item.last);
|
|
157
275
|
const reply = item.reply.join('\n\n').trim();
|
|
158
|
-
const [menu, onContextMenu] = useMessageMenu({
|
|
276
|
+
const [menu, onContextMenu] = useMessageMenu({
|
|
277
|
+
kind: 'turn',
|
|
278
|
+
last: item.active ? undefined : item.last,
|
|
279
|
+
reply: item.active ? '' : reply,
|
|
280
|
+
session,
|
|
281
|
+
messages: item.messages,
|
|
282
|
+
});
|
|
159
283
|
return (React.createElement("div", { className: `ta-message ta-assistant ${item.active ? 'ta-turn-live' : ''}`, onContextMenu: onContextMenu },
|
|
160
284
|
React.createElement(Process, { steps: item.steps, active: item.active, results: results, tools: tools, leading: React.createElement(TurnAvatar, { mood: mood }), status: status }),
|
|
161
|
-
item.reply.map((text, index) => (React.createElement(Markdown, { key: index, text: text }))),
|
|
285
|
+
item.reply.map((text, index) => (React.createElement(Markdown, { key: index, text: text, streaming: item.active && index === item.reply.length - 1 }))),
|
|
162
286
|
!item.active && stopReason === 'error' && errorMessage && React.createElement(Callout, { level: "error" }, errorMessage),
|
|
163
287
|
!item.active && stopReason === 'aborted' && React.createElement("div", { className: "ta-muted ta-small" }, t('ta.message.stopped')),
|
|
164
|
-
!item.active && React.createElement(TurnFooter, { messages: item.messages, last: item.last, reply: reply, session: session }),
|
|
288
|
+
!item.active && React.createElement(TurnFooter, { messages: item.messages, last: item.last, reply: reply, session: session, latest: latest }),
|
|
165
289
|
menu));
|
|
166
290
|
}
|
|
167
291
|
/** `!command` of a user, which pi records as its own kind of message. */
|
|
@@ -204,18 +328,22 @@ function Message({ item }) {
|
|
|
204
328
|
* One item of the conversation. The store replaces only the message that changed, so an item draws
|
|
205
329
|
* again only when one of its messages did, or, while ta is at it, when a tool run did.
|
|
206
330
|
*/
|
|
207
|
-
const ThreadRow = React.memo(function ThreadRow({ item, tools, mood, status }) {
|
|
208
|
-
return item.kind === 'turn' ? React.createElement(Turn, { item: item, tools: tools, mood: mood, status: status }) : React.createElement(Message, { item: item });
|
|
331
|
+
const ThreadRow = React.memo(function ThreadRow({ item, tools, mood, status, latest, }) {
|
|
332
|
+
return item.kind === 'turn' ? React.createElement(Turn, { item: item, tools: tools, mood: mood, status: status, latest: latest }) : React.createElement(Message, { item: item });
|
|
209
333
|
}, (previous, next) => previous.mood === next.mood &&
|
|
210
334
|
previous.status === next.status &&
|
|
335
|
+
previous.latest === next.latest &&
|
|
211
336
|
ProcessUtil.same(previous.item, next.item) &&
|
|
212
337
|
(next.item.kind === 'message' || !next.item.active || previous.tools === next.tools));
|
|
213
338
|
/** The last rows, which change and are in view, are always laid out. */
|
|
214
339
|
const SETTLED_AFTER = 4;
|
|
215
340
|
/** The conversation; tool results show with the calls they answer. */
|
|
216
|
-
export function MessageList({ state }) {
|
|
341
|
+
export function MessageList({ state, outbox }) {
|
|
217
342
|
var _a;
|
|
218
343
|
const items = React.useMemo(() => ProcessUtil.items(state.messages, state.working, state.start), [state.messages, state.working, state.start]);
|
|
344
|
+
const renderers = React.useContext(MessageRenderers);
|
|
345
|
+
const breaks = React.useMemo(() => ProcessUtil.timeBreaks(ProcessUtil.starts(items), index => ProcessUtil.shown(items[index], renderers)), [items, renderers]);
|
|
346
|
+
const sent = React.useMemo(() => { var _a; return ({ of: new Map(((_a = state.outbox) !== null && _a !== void 0 ? _a : []).map(message => [message.message, message])), actions: outbox }); }, [state.outbox, outbox]);
|
|
219
347
|
// Rows of earlier messages put in front are laid out once before they may skip it (content-visibility):
|
|
220
348
|
// their height is then known, and the view does not move as they come near it.
|
|
221
349
|
const firstKey = React.useRef((_a = items[0]) === null || _a === void 0 ? void 0 : _a.key);
|
|
@@ -240,7 +368,7 @@ export function MessageList({ state }) {
|
|
|
240
368
|
// What ta does while it works: on the head of a turn that shows nothing yet, else under all it has shown.
|
|
241
369
|
const status = state.working || state.compacting ? React.createElement(RunStatus, { state: state }) : undefined;
|
|
242
370
|
const onHead = status && quiet(last);
|
|
243
|
-
return (React.createElement(
|
|
371
|
+
return (React.createElement(Outbox.Provider, { value: sent },
|
|
244
372
|
items.map((item, index) => (React.createElement("div", { key: item.key, className: [
|
|
245
373
|
'ta-thread-item',
|
|
246
374
|
index >= front && index < items.length - SETTLED_AFTER && 'ta-settled',
|
|
@@ -250,7 +378,8 @@ export function MessageList({ state }) {
|
|
|
250
378
|
]
|
|
251
379
|
.filter(Boolean)
|
|
252
380
|
.join(' ') },
|
|
253
|
-
React.createElement(
|
|
381
|
+
breaks[index] !== undefined && React.createElement(TimeBreak, { timestamp: breaks[index] }),
|
|
382
|
+
React.createElement(ThreadRow, { item: item, tools: state.tools, mood: item.kind === 'turn' ? ProcessUtil.mood(item, index === lastTurn, waiting) : 'idle', status: onHead && item === last ? status : undefined, latest: index === lastTurn })))),
|
|
254
383
|
status && !onHead && React.createElement("div", { className: "ta-run-line" }, status)));
|
|
255
384
|
}
|
|
256
385
|
//# sourceMappingURL=message-list.js.map
|
|
@@ -11,10 +11,12 @@ export type MessageMenuSubject = {
|
|
|
11
11
|
last?: SessionMessage;
|
|
12
12
|
reply: string;
|
|
13
13
|
session?: TaSessionInfo;
|
|
14
|
+
messages?: SessionMessage[];
|
|
14
15
|
};
|
|
15
16
|
/**
|
|
16
17
|
* The menu of a message under a held finger, as in WeChat: copy it, select its text (in a sheet of its own, as
|
|
17
|
-
* WeChat shows a message to select from), and what its footer does
|
|
18
|
+
* WeChat shows a message to select from), and what its footer does; above them, what the footer says (when,
|
|
19
|
+
* what the turn took), since a touch screen shows no footer but that of the last turn.
|
|
18
20
|
* On a touch screen only; a right click elsewhere keeps the menu of the browser, which copies a selection.
|
|
19
21
|
*/
|
|
20
22
|
export declare function useMessageMenu(subject: MessageMenuSubject): [React.ReactNode, ((event: React.MouseEvent<HTMLElement>) => void) | undefined];
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useDevice } from '../device/device.js';
|
|
3
3
|
import { useT } from '../i18n/use-t.js';
|
|
4
|
+
import { MessageUtil } from '../util/message.js';
|
|
5
|
+
import { ProgressUtil } from '../util/progress.js';
|
|
4
6
|
import { useContextMenu } from './context-menu.js';
|
|
5
|
-
import { MessageActions, MessageFooterUtil } from './message-footer.js';
|
|
7
|
+
import { MessageActions, MessageFooterUtil, useTimeLabel } from './message-footer.js';
|
|
6
8
|
import { WebDialog } from './web-dialog.js';
|
|
7
9
|
/** Where a held finger is something else's: a link, a button, code, an image, the steps of a turn. */
|
|
8
10
|
const OWN_PRESS = 'a, button, img, video, .ta-code, pre, .ta-process-steps, .ta-footer';
|
|
9
11
|
/**
|
|
10
12
|
* The menu of a message under a held finger, as in WeChat: copy it, select its text (in a sheet of its own, as
|
|
11
|
-
* WeChat shows a message to select from), and what its footer does
|
|
13
|
+
* WeChat shows a message to select from), and what its footer does; above them, what the footer says (when,
|
|
14
|
+
* what the turn took), since a touch screen shows no footer but that of the last turn.
|
|
12
15
|
* On a touch screen only; a right click elsewhere keeps the menu of the browser, which copies a selection.
|
|
13
16
|
*/
|
|
14
17
|
export function useMessageMenu(subject) {
|
|
15
18
|
const t = useT();
|
|
19
|
+
const timeLabel = useTimeLabel();
|
|
16
20
|
const touch = useDevice(device => device.touch);
|
|
17
21
|
const actions = React.useContext(MessageActions);
|
|
18
22
|
const [menu, open] = useContextMenu();
|
|
@@ -46,7 +50,18 @@ export function useMessageMenu(subject) {
|
|
|
46
50
|
items.push({ label: t('ta.message.debug'), run: () => copy(MessageFooterUtil.debugInfo(last, subject.session), t('ta.message.debugCopied')) });
|
|
47
51
|
}
|
|
48
52
|
if (items.length) {
|
|
49
|
-
|
|
53
|
+
const said = subject.kind === 'user' ? subject.message : subject.last;
|
|
54
|
+
const at = said === null || said === void 0 ? void 0 : said.timestamp;
|
|
55
|
+
const usage = subject.kind === 'turn' && subject.messages ? MessageUtil.usage(subject.messages) : undefined;
|
|
56
|
+
const caption = [
|
|
57
|
+
at !== undefined && timeLabel(at),
|
|
58
|
+
usage &&
|
|
59
|
+
(usage.input > 0 || usage.output > 0) &&
|
|
60
|
+
`${t('ta.message.used')} ↑${ProgressUtil.format(usage.input)} ↓${ProgressUtil.format(usage.output)}${usage.cost > 0 ? ` ${MessageUtil.cost(usage.cost)}` : ''}`,
|
|
61
|
+
]
|
|
62
|
+
.filter(Boolean)
|
|
63
|
+
.join(' · ');
|
|
64
|
+
open(event, items, caption || undefined);
|
|
50
65
|
}
|
|
51
66
|
};
|
|
52
67
|
return [
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Hold } from '../device/hold.js';
|
|
1
2
|
import { type WebViewEntry } from '../extension/web-extension-protocol.js';
|
|
2
3
|
import { type NavigationSetting } from '../settings/navigation.js';
|
|
3
4
|
import type { ContextMenuItem } from './context-menu.js';
|
|
@@ -8,6 +9,17 @@ import { type SideList } from './side-lists.js';
|
|
|
8
9
|
* extensions started on open from the launcher (ta-launcher.md), as they come and go.
|
|
9
10
|
*/
|
|
10
11
|
export declare function railPages(views: WebViewEntry[]): WebViewEntry[];
|
|
12
|
+
/**
|
|
13
|
+
* What an entry of the navigation does while it is held, without a menu: the double opens and listens to what is
|
|
14
|
+
* said to it, the chats open a new conversation that does (HeldTalk). None where the browser cannot recognize
|
|
15
|
+
* speech: the entries are a tap. The chats are the list without an id.
|
|
16
|
+
*/
|
|
17
|
+
export interface EntryHolds {
|
|
18
|
+
double?: Hold;
|
|
19
|
+
chats?: Hold;
|
|
20
|
+
}
|
|
21
|
+
/** The hold of an entry of the navigation: the double's, the chats'; pages keep their menus (their fold and the settings). */
|
|
22
|
+
export declare function entryHold(id: string, double: boolean | undefined, holds: EntryHolds): Hold | undefined;
|
|
11
23
|
/** The id of Discover where the navigation has the ids of pages: a tab of a phone, `current` of the rail. */
|
|
12
24
|
export declare const DISCOVER = "ta/discover";
|
|
13
25
|
/** The last tab of a phone: the account and the settings, as the menu of the account on the rail. */
|
|
@@ -38,9 +50,12 @@ export interface PhoneTabLabels {
|
|
|
38
50
|
fold: string;
|
|
39
51
|
/** The settings of the navigation, in the menu of a page's tab and of Discover. */
|
|
40
52
|
settings: Exclude<ContextMenuItem, '-'>;
|
|
53
|
+
/** What a held tab of the double or of the chats does. */
|
|
54
|
+
holds: EntryHolds;
|
|
41
55
|
}
|
|
42
56
|
/**
|
|
43
57
|
* The tabs at the bottom of a phone, as a messaging app has them: the lists of the sidebar, the chats, the pages
|
|
44
|
-
* in the navigation, Discover once some are under it, Me. A held tab of a page puts it under Discover
|
|
58
|
+
* in the navigation, Discover once some are under it, Me. A held tab of a page puts it under Discover; that of the
|
|
59
|
+
* double talks to it while it is held, and that of the chats to a new conversation.
|
|
45
60
|
*/
|
|
46
61
|
export declare function phoneTabs(lists: SideList[], navigation: Navigation, labels: PhoneTabLabels): PhoneTab[];
|
|
@@ -11,6 +11,13 @@ export function railPages(views) {
|
|
|
11
11
|
const listed = new Set(views.flatMap(view => { var _a; return (view.location === 'sidebar' ? ((_a = view.pages) !== null && _a !== void 0 ? _a : []) : []); }));
|
|
12
12
|
return views.filter(view => view.location === 'page' && !view.onOpen && !listed.has(view.id));
|
|
13
13
|
}
|
|
14
|
+
/** The hold of an entry of the navigation: the double's, the chats'; pages keep their menus (their fold and the settings). */
|
|
15
|
+
export function entryHold(id, double, holds) {
|
|
16
|
+
if (double) {
|
|
17
|
+
return holds.double;
|
|
18
|
+
}
|
|
19
|
+
return id === '' ? holds.chats : undefined;
|
|
20
|
+
}
|
|
14
21
|
/** The id of Discover where the navigation has the ids of pages: a tab of a phone, `current` of the rail. */
|
|
15
22
|
export const DISCOVER = 'ta/discover';
|
|
16
23
|
/** The last tab of a phone: the account and the settings, as the menu of the account on the rail. */
|
|
@@ -29,7 +36,8 @@ export function places(views, setting, handheld) {
|
|
|
29
36
|
}
|
|
30
37
|
/**
|
|
31
38
|
* The tabs at the bottom of a phone, as a messaging app has them: the lists of the sidebar, the chats, the pages
|
|
32
|
-
* in the navigation, Discover once some are under it, Me. A held tab of a page puts it under Discover
|
|
39
|
+
* in the navigation, Discover once some are under it, Me. A held tab of a page puts it under Discover; that of the
|
|
40
|
+
* double talks to it while it is held, and that of the chats to a new conversation.
|
|
33
41
|
*/
|
|
34
42
|
export function phoneTabs(lists, navigation, labels) {
|
|
35
43
|
const tab = (view, menu) => { var _a; return ({
|
|
@@ -38,9 +46,10 @@ export function phoneTabs(lists, navigation, labels) {
|
|
|
38
46
|
icon: (_a = view.icon) !== null && _a !== void 0 ? _a : PanelTop,
|
|
39
47
|
menu,
|
|
40
48
|
}); };
|
|
49
|
+
const list = (entry) => ({ ...entry, hold: entryHold(entry.id, entry.double, labels.holds) });
|
|
41
50
|
return [
|
|
42
|
-
...(navigation.home ? [{ ...tab(navigation.home), double: true }] : []),
|
|
43
|
-
...lists,
|
|
51
|
+
...(navigation.home ? [{ ...tab(navigation.home), double: true, hold: labels.holds.double }] : []),
|
|
52
|
+
...lists.map(list),
|
|
44
53
|
...navigation.nav.map(view => tab(view, [{ label: labels.fold, run: () => navigation.fold(view.id) }, '-', labels.settings])),
|
|
45
54
|
...(navigation.discover.length > 0 ? [{ id: DISCOVER, label: labels.discover, icon: Compass, menu: [labels.settings] }] : []),
|
|
46
55
|
{ id: ME_TAB, label: labels.me, icon: User },
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { type Hold } from '../device/hold.js';
|
|
2
3
|
import type { WebIcon } from '../extension/web-extension-api.js';
|
|
3
4
|
import { type ContextMenuItem } from './context-menu.js';
|
|
4
5
|
/** A tab at the bottom of the phone: a list of the sidebar, a page of the rail, Discover, or Me. */
|
|
@@ -8,8 +9,10 @@ export interface PhoneTab {
|
|
|
8
9
|
icon: WebIcon;
|
|
9
10
|
/** The double's tab: drawn as its face (DinoFace), not its icon. */
|
|
10
11
|
double?: boolean;
|
|
11
|
-
/** Its menu, for a held finger. */
|
|
12
|
+
/** Its menu, for a held finger (the pages of the navigation, Discover). */
|
|
12
13
|
menu?: ContextMenuItem[];
|
|
14
|
+
/** What it does while it is held instead: the double listens, the chats open a new conversation. */
|
|
15
|
+
hold?: Hold;
|
|
13
16
|
}
|
|
14
17
|
export interface PhoneShellProps {
|
|
15
18
|
tabs: PhoneTab[];
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { useBackStack } from '../device/back-stack.js';
|
|
3
3
|
import { useDevice } from '../device/device.js';
|
|
4
4
|
import { DeviceMotion } from '../device/device-protocol.js';
|
|
5
|
+
import { useHeld } from '../device/hold.js';
|
|
5
6
|
import { usePullDown } from '../device/pull-down.js';
|
|
6
7
|
import { useSheetSwipe } from '../device/sheet-swipe.js';
|
|
7
8
|
import { useT } from '../i18n/use-t.js';
|
|
@@ -196,11 +197,12 @@ export function PhoneStack({ base, top, open, onClose }) {
|
|
|
196
197
|
function TabBar({ tabs, tab, onTab }) {
|
|
197
198
|
const t = useT();
|
|
198
199
|
const [menu, openMenu] = useContextMenu();
|
|
200
|
+
const held = useHeld();
|
|
199
201
|
return (React.createElement("nav", { className: "ta-tabbar", "aria-label": t('ta.menu') },
|
|
200
202
|
tabs.map(item => {
|
|
201
203
|
const Glyph = item.icon;
|
|
202
204
|
const active = item.id === tab;
|
|
203
|
-
return (React.createElement("button", { key: item.id, type: "button", className: `ta-tabbar-item${active ? ' ta-active' : ''}`, "aria-current": active ? 'page' : undefined, onClick: event => (active ? PhoneUtil.toTop(event.currentTarget.closest('.ta-phone-home')) : onTab(item.id)), onContextMenu: item.menu
|
|
205
|
+
return (React.createElement("button", { key: item.id, type: "button", className: `ta-tabbar-item${active ? ' ta-active' : ''}`, "aria-current": active ? 'page' : undefined, onClick: event => (active ? PhoneUtil.toTop(event.currentTarget.closest('.ta-phone-home')) : onTab(item.id)), onContextMenu: item.menu ? event => { var _a; return openMenu(event, (_a = item.menu) !== null && _a !== void 0 ? _a : []); } : undefined, ...held(item.hold) },
|
|
204
206
|
item.double ? React.createElement(DinoFace, { size: 24, className: "ta-nav-face" }) : React.createElement(Glyph, { size: 22, strokeWidth: active ? 2 : 1.6 }),
|
|
205
207
|
React.createElement("span", null, item.label)));
|
|
206
208
|
}),
|
|
@@ -4,11 +4,11 @@ import { useT } from '../i18n/use-t.js';
|
|
|
4
4
|
import { ProgressUtil } from '../util/progress.js';
|
|
5
5
|
import { ToolUtil } from '../util/tool.js';
|
|
6
6
|
import { Icon } from './icon.js';
|
|
7
|
-
function usePhaseText(phase) {
|
|
7
|
+
function usePhaseText(phase, working) {
|
|
8
8
|
const t = useT();
|
|
9
9
|
switch (phase.kind) {
|
|
10
10
|
case 'waiting':
|
|
11
|
-
return t('ta.progress.waiting');
|
|
11
|
+
return working !== null && working !== void 0 ? working : t('ta.progress.waiting');
|
|
12
12
|
case 'thinking':
|
|
13
13
|
return t('ta.session.phase.thinking');
|
|
14
14
|
case 'writing':
|
|
@@ -38,7 +38,7 @@ function usePhaseText(phase) {
|
|
|
38
38
|
export function RunStatus({ state }) {
|
|
39
39
|
const t = useT();
|
|
40
40
|
const phase = ProgressUtil.phase(state);
|
|
41
|
-
const text = usePhaseText(phase);
|
|
41
|
+
const text = usePhaseText(phase, state.workingMessage);
|
|
42
42
|
const { input, output } = ProgressUtil.tokens(state);
|
|
43
43
|
return (React.createElement("span", { className: "ta-run-status", role: "status" },
|
|
44
44
|
React.createElement("span", { className: `ta-status ${phase.kind === 'attention' || phase.kind === 'retrying' ? 'ta-status-waiting' : 'ta-status-running'}` }),
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { WebSelectBarProps, WebSelectCheckProps } from '../extension/web-extension-api.js';
|
|
3
|
+
/** The round mark at the start of a row while its list is selecting, as WeChat's: filled once chosen. */
|
|
4
|
+
export declare function SelectCheck({ checked, disabled }: WebSelectCheckProps): React.JSX.Element;
|
|
5
|
+
/**
|
|
6
|
+
* Under a list that is selecting: Select all (or none, once all are), how many are chosen, what can be done
|
|
7
|
+
* with them and Done. Every list of the page and of web extensions (`ui.SelectBar`) takes it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function SelectBar({ count, total, onSelectAll, onDone, actions }: WebSelectBarProps): React.JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Check } from 'lucide-react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useT } from '../i18n/use-t.js';
|
|
4
|
+
import { Icon } from './icon.js';
|
|
5
|
+
/** The round mark at the start of a row while its list is selecting, as WeChat's: filled once chosen. */
|
|
6
|
+
export function SelectCheck({ checked, disabled }) {
|
|
7
|
+
return (React.createElement("span", { className: "ta-select-check", "data-checked": checked ? '' : undefined, "data-disabled": disabled ? '' : undefined, "aria-hidden": "true" }, checked && React.createElement(Icon, { icon: Check, size: 12 })));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Under a list that is selecting: Select all (or none, once all are), how many are chosen, what can be done
|
|
11
|
+
* with them and Done. Every list of the page and of web extensions (`ui.SelectBar`) takes it.
|
|
12
|
+
*/
|
|
13
|
+
export function SelectBar({ count, total, onSelectAll, onDone, actions }) {
|
|
14
|
+
const t = useT();
|
|
15
|
+
const all = total > 0 && count >= total;
|
|
16
|
+
return (React.createElement("div", { className: "ta-select-bar", role: "toolbar", "aria-label": t('ta.select.count', { count }) },
|
|
17
|
+
React.createElement("button", { type: "button", className: "ta-select-bar-all", disabled: total === 0, onClick: () => onSelectAll(!all) },
|
|
18
|
+
React.createElement(SelectCheck, { checked: all }),
|
|
19
|
+
t('ta.select.all')),
|
|
20
|
+
React.createElement("span", { className: "ta-select-bar-count", "aria-live": "polite" }, t('ta.select.count', { count })),
|
|
21
|
+
actions.map(action => (React.createElement("button", { key: action.key, type: "button", className: `ta-button ta-select-bar-action${action.danger ? ' ta-danger' : ''}`, disabled: count === 0, onClick: action.run }, action.label))),
|
|
22
|
+
React.createElement("button", { type: "button", className: "ta-button ta-select-bar-done", onClick: onDone }, t('ta.select.done'))));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=select-bar.js.map
|
|
@@ -22,6 +22,12 @@ export interface SessionSettingsHandlers {
|
|
|
22
22
|
}
|
|
23
23
|
export declare namespace SessionSettingsUtil {
|
|
24
24
|
const EMPTY: SessionSettings;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the settings are loaded again: at once, a run going or not, so that a conversation opened
|
|
27
|
+
* while it works (a new one, the first message just sent) lists its models from the start, and after
|
|
28
|
+
* each run, which an extension or another client may have changed them in.
|
|
29
|
+
*/
|
|
30
|
+
function reloads(wasWorking: boolean | undefined, working: boolean): boolean;
|
|
25
31
|
function modelRef(model?: {
|
|
26
32
|
provider: string;
|
|
27
33
|
id: string;
|
|
@@ -5,6 +5,15 @@ import { ModelPickerUtil, useModelSource } from './model-picker.js';
|
|
|
5
5
|
export var SessionSettingsUtil;
|
|
6
6
|
(function (SessionSettingsUtil) {
|
|
7
7
|
SessionSettingsUtil.EMPTY = { models: [], levels: [], commands: [] };
|
|
8
|
+
/**
|
|
9
|
+
* Whether the settings are loaded again: at once, a run going or not, so that a conversation opened
|
|
10
|
+
* while it works (a new one, the first message just sent) lists its models from the start, and after
|
|
11
|
+
* each run, which an extension or another client may have changed them in.
|
|
12
|
+
*/
|
|
13
|
+
function reloads(wasWorking, working) {
|
|
14
|
+
return wasWorking === undefined || (wasWorking && !working);
|
|
15
|
+
}
|
|
16
|
+
SessionSettingsUtil.reloads = reloads;
|
|
8
17
|
function modelRef(model) {
|
|
9
18
|
return model ? `${model.provider}/${model.id}` : '';
|
|
10
19
|
}
|
|
@@ -73,10 +82,14 @@ export function useSessionSettings(server, settingsServer, store, working, t, on
|
|
|
73
82
|
.then(([state, { models }, { levels }, { commands }]) => setSettings({ models, model: SessionSettingsUtil.modelRef(state.model), thinkingLevel: state.thinkingLevel, levels, commands }))
|
|
74
83
|
.catch(() => undefined);
|
|
75
84
|
}, [server, sessionId]);
|
|
85
|
+
// Whether the session worked when it was last looked at; none for a session not looked at yet.
|
|
86
|
+
const last = React.useRef(undefined);
|
|
76
87
|
React.useEffect(() => {
|
|
77
|
-
|
|
88
|
+
var _a;
|
|
89
|
+
if (SessionSettingsUtil.reloads(((_a = last.current) === null || _a === void 0 ? void 0 : _a.load) === load ? last.current.working : undefined, working)) {
|
|
78
90
|
load();
|
|
79
91
|
}
|
|
92
|
+
last.current = { load, working };
|
|
80
93
|
}, [load, working]);
|
|
81
94
|
React.useEffect(() => store.onEvent(event => {
|
|
82
95
|
if (event.type === 'session_reloaded') {
|