@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
|
@@ -11,6 +11,8 @@ export interface AssistantTaskActions {
|
|
|
11
11
|
/** Shows the double, where a start waits for the user's go. */
|
|
12
12
|
openDouble(): void;
|
|
13
13
|
menu(task: AssistantTask): WebMenuItem[][];
|
|
14
|
+
/** Deletes it without asking (WebTask.remove). */
|
|
15
|
+
remove(task: AssistantTask): Promise<void>;
|
|
14
16
|
}
|
|
15
17
|
/** What of a task's session the list shows: a new task object only when it changes. */
|
|
16
18
|
interface Shown {
|
|
@@ -154,6 +154,8 @@ class AssistantTaskSource {
|
|
|
154
154
|
origin: task.origin,
|
|
155
155
|
open: () => this.actions.open(task),
|
|
156
156
|
menu: () => this.actions.menu(task),
|
|
157
|
+
remove: () => this.actions.remove(task),
|
|
158
|
+
removeHint: this.actions.t('ta.task.removeHint'),
|
|
157
159
|
};
|
|
158
160
|
}
|
|
159
161
|
}
|
|
@@ -13,6 +13,8 @@ export declare namespace AssistantTaskUtil {
|
|
|
13
13
|
/**
|
|
14
14
|
* The tasks of both lists, each in its newer copy (the higher `rev`; the server's, `theirs`, when
|
|
15
15
|
* both are as new, so that the pages end with the same), in the order they started; the last MAX_TASKS.
|
|
16
|
+
* A task taken off the list in either stays off: a page that changed it meanwhile, as often, does not
|
|
17
|
+
* bring it back.
|
|
16
18
|
*/
|
|
17
19
|
function merge(ours: readonly AssistantTask[], theirs: readonly AssistantTask[]): AssistantTask[];
|
|
18
20
|
/** The tasks the lists show. */
|
|
@@ -43,6 +45,12 @@ export declare namespace AssistantTaskUtil {
|
|
|
43
45
|
function lastWords(messages: readonly SessionMessage[]): string | undefined;
|
|
44
46
|
/** What the double reads when a task ended. */
|
|
45
47
|
function updateNote(task: AssistantTask): string;
|
|
48
|
+
/** The task a note of updateNote is about, if `text` is one. */
|
|
49
|
+
function noteOf(text: string): {
|
|
50
|
+
id: string;
|
|
51
|
+
title: string;
|
|
52
|
+
status: AssistantTask['status'];
|
|
53
|
+
} | undefined;
|
|
46
54
|
/** What the double reads when the user hands it one of their conversations. */
|
|
47
55
|
function adoptedNote(task: AssistantTask, said: string): string;
|
|
48
56
|
}
|
|
@@ -6,6 +6,8 @@ const message_1 = require("../util/message");
|
|
|
6
6
|
exports.MAX_TASKS = 50;
|
|
7
7
|
/** As much of what a task said as the double reads. */
|
|
8
8
|
const RESULT_CHARS = 4000;
|
|
9
|
+
/** The start of a note of updateNote. */
|
|
10
|
+
const NOTE = /^<task_update id="([^"]+)" title="([^"]*)" status="(\w+)">/;
|
|
9
11
|
/**
|
|
10
12
|
* What the pages of the double agree on about its tasks. Every page of the user lists them, follows those
|
|
11
13
|
* that run and keeps the list on the server: no one page owns them, so a change is a newer copy of a task,
|
|
@@ -18,6 +20,8 @@ var AssistantTaskUtil;
|
|
|
18
20
|
/**
|
|
19
21
|
* The tasks of both lists, each in its newer copy (the higher `rev`; the server's, `theirs`, when
|
|
20
22
|
* both are as new, so that the pages end with the same), in the order they started; the last MAX_TASKS.
|
|
23
|
+
* A task taken off the list in either stays off: a page that changed it meanwhile, as often, does not
|
|
24
|
+
* bring it back.
|
|
21
25
|
*/
|
|
22
26
|
function merge(ours, theirs) {
|
|
23
27
|
var _a, _b;
|
|
@@ -27,9 +31,9 @@ var AssistantTaskUtil;
|
|
|
27
31
|
}
|
|
28
32
|
for (const task of theirs) {
|
|
29
33
|
const mine = byId.get(task.id);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
34
|
+
const newer = !mine || ((_a = task.rev) !== null && _a !== void 0 ? _a : 0) >= ((_b = mine.rev) !== null && _b !== void 0 ? _b : 0) ? task : mine;
|
|
35
|
+
const removed = !!(task.removed || (mine === null || mine === void 0 ? void 0 : mine.removed));
|
|
36
|
+
byId.set(task.id, removed && !newer.removed ? { ...newer, removed } : newer);
|
|
33
37
|
}
|
|
34
38
|
return [...byId.values()].sort((a, b) => number(a.id) - number(b.id) || a.startedAt - b.startedAt).slice(-exports.MAX_TASKS);
|
|
35
39
|
}
|
|
@@ -93,6 +97,12 @@ var AssistantTaskUtil;
|
|
|
93
97
|
return `<task_update id="${task.id}" title="${task.title}" status="${task.status}">\n${((_a = task.result) !== null && _a !== void 0 ? _a : '').slice(0, RESULT_CHARS)}\n</task_update>`;
|
|
94
98
|
}
|
|
95
99
|
AssistantTaskUtil.updateNote = updateNote;
|
|
100
|
+
/** The task a note of updateNote is about, if `text` is one. */
|
|
101
|
+
function noteOf(text) {
|
|
102
|
+
const match = NOTE.exec(text);
|
|
103
|
+
return match ? { id: match[1], title: match[2], status: match[3] } : undefined;
|
|
104
|
+
}
|
|
105
|
+
AssistantTaskUtil.noteOf = noteOf;
|
|
96
106
|
/** What the double reads when the user hands it one of their conversations. */
|
|
97
107
|
function adoptedNote(task, said) {
|
|
98
108
|
return `<task_adopted id="${task.id}" title="${task.title}" status="${task.status}">\nThe user handed you one of their conversations, in ${task.cwd}: follow it as your task ${task.id}. Its last words:\n${said.slice(0, RESULT_CHARS)}\n</task_adopted>`;
|
|
@@ -62,8 +62,9 @@ exports.ASSISTANT_TASKS_VIEW = 'tasks';
|
|
|
62
62
|
/** Every task, the double's and those of extensions, what waits for the user first: a tool of the workbench beside the conversation. */
|
|
63
63
|
function AssistantTasks() {
|
|
64
64
|
const tasks = (0, hooks_1.useTasks)();
|
|
65
|
+
const remove = (0, hooks_1.useRemoveTasks)();
|
|
65
66
|
return (React.createElement("div", { className: "ta-assistant-tasks" },
|
|
66
|
-
React.createElement(task_views_1.TaskBoardList, { tasks: tasks })));
|
|
67
|
+
React.createElement(task_views_1.TaskBoardList, { tasks: tasks, onRemove: remove })));
|
|
67
68
|
}
|
|
68
69
|
/** The … of a task, from the sections its extension gives: the same entries as in the lists. */
|
|
69
70
|
function sectionItems(sections) {
|
|
@@ -41,6 +41,7 @@ const React = __importStar(require("react"));
|
|
|
41
41
|
const callout_1 = require("../components/callout");
|
|
42
42
|
const composer_1 = require("../components/composer");
|
|
43
43
|
const composer_addons_1 = require("../components/composer-addons");
|
|
44
|
+
const connection_bar_1 = require("../components/connection-bar");
|
|
44
45
|
const conversation_scroll_1 = require("../components/conversation-scroll");
|
|
45
46
|
const dialog_view_1 = require("../components/dialog-view");
|
|
46
47
|
const earlier_messages_1 = require("../components/earlier-messages");
|
|
@@ -123,37 +124,33 @@ function lastReply(messages, start) {
|
|
|
123
124
|
}
|
|
124
125
|
return undefined;
|
|
125
126
|
}
|
|
126
|
-
/** When an item of the conversation began: its first message; one still empty (a turn about to come), when the one before did. */
|
|
127
|
-
function startsOf(items) {
|
|
128
|
-
let last = Number.NEGATIVE_INFINITY;
|
|
129
|
-
return items.map(item => {
|
|
130
|
-
const first = item.kind === 'turn' ? item.messages[0] : item.message;
|
|
131
|
-
const at = first === null || first === void 0 ? void 0 : first.timestamp;
|
|
132
|
-
last = typeof at === 'number' ? at : last;
|
|
133
|
-
return last;
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
127
|
/** A turn of the double: held, it opens the same menu as a turn of a conversation (message-menu.tsx). */
|
|
137
|
-
function DoubleTurn({ item, children }) {
|
|
128
|
+
function DoubleTurn({ item, latest, children }) {
|
|
138
129
|
const reply = item.reply.join('\n\n').trim();
|
|
139
|
-
const [menu, onContextMenu] = (0, message_menu_1.useMessageMenu)({
|
|
130
|
+
const [menu, onContextMenu] = (0, message_menu_1.useMessageMenu)({
|
|
131
|
+
kind: 'turn',
|
|
132
|
+
last: item.active ? undefined : item.last,
|
|
133
|
+
reply: item.active ? '' : reply,
|
|
134
|
+
messages: item.messages,
|
|
135
|
+
});
|
|
140
136
|
return (React.createElement("div", { className: `ta-msg-ta ${item.active ? 'ta-turn-live' : ''}`, onContextMenu: onContextMenu },
|
|
141
137
|
children,
|
|
142
|
-
!item.active && React.createElement(message_footer_1.TurnFooter, { messages: item.messages, last: item.last, reply: reply }),
|
|
138
|
+
!item.active && React.createElement(message_footer_1.TurnFooter, { messages: item.messages, last: item.last, reply: reply, latest: latest }),
|
|
143
139
|
menu));
|
|
144
140
|
}
|
|
145
141
|
/** What the user said to the double: held, the same menu as a message of a conversation. */
|
|
146
142
|
function DoubleUserMessage({ message, blocks, text }) {
|
|
147
143
|
const [menu, onContextMenu] = (0, message_menu_1.useMessageMenu)({ kind: 'user', message, text });
|
|
148
144
|
return (React.createElement("div", { className: `ta-msg-user ${conversation_scroll_1.ASK_CLASS}`, onContextMenu: onContextMenu },
|
|
149
|
-
React.createElement(message_list_1.
|
|
150
|
-
text && React.createElement("div", { className: "ta-msg-bubble" }, text),
|
|
145
|
+
React.createElement(message_list_1.UserSaid, { blocks: blocks, text: text, bubble: "ta-msg-bubble" }),
|
|
151
146
|
React.createElement(message_footer_1.UserFooter, { message: message, text: text }),
|
|
152
147
|
menu));
|
|
153
148
|
}
|
|
154
149
|
function Conversation({ state, tasks, origin, onTask, t }) {
|
|
155
150
|
const items = React.useMemo(() => process_1.ProcessUtil.items(state.messages, state.working, state.start), [state.messages, state.working, state.start]);
|
|
156
|
-
const starts = React.useMemo(() =>
|
|
151
|
+
const starts = React.useMemo(() => process_1.ProcessUtil.starts(items), [items]);
|
|
152
|
+
const renderers = React.useContext(extension_view_1.MessageRenderers);
|
|
153
|
+
const breaks = React.useMemo(() => process_1.ProcessUtil.timeBreaks(starts, index => process_1.ProcessUtil.shown(items[index], renderers)), [starts, items, renderers]);
|
|
157
154
|
const own = React.useMemo(() => tasks.filter(task => task.origin && task.origin === origin), [tasks, origin]);
|
|
158
155
|
let lastTurn = items.length - 1;
|
|
159
156
|
while (lastTurn >= 0 && items[lastTurn].kind !== 'turn') {
|
|
@@ -163,40 +160,43 @@ function Conversation({ state, tasks, origin, onTask, t }) {
|
|
|
163
160
|
const last = items[items.length - 1];
|
|
164
161
|
const status = state.working || state.compacting ? React.createElement(run_status_1.RunStatus, { state: state }) : undefined;
|
|
165
162
|
const onHead = status && (0, message_list_1.quiet)(last);
|
|
163
|
+
const row = (item, index) => {
|
|
164
|
+
var _a, _b;
|
|
165
|
+
if (item.kind === 'turn') {
|
|
166
|
+
const results = message_1.MessageUtil.results(item.messages);
|
|
167
|
+
const { errorMessage } = ((_a = item.last) !== null && _a !== void 0 ? _a : {});
|
|
168
|
+
const stopReason = message_1.MessageUtil.stopReason(item.last);
|
|
169
|
+
const mood = process_1.ProcessUtil.mood(item, index === lastTurn, waiting);
|
|
170
|
+
const started = web_tasks_1.WebTaskUtil.startedIn(own, origin, starts[index], (_b = starts[index + 1]) !== null && _b !== void 0 ? _b : Number.POSITIVE_INFINITY);
|
|
171
|
+
return (React.createElement(DoubleTurn, { key: item.key, item: item, latest: index === lastTurn },
|
|
172
|
+
React.createElement(message_list_1.Process, { steps: item.steps, active: item.active, results: results, tools: state.tools, leading: React.createElement(message_list_1.TurnAvatar, { mood: mood }), status: onHead && item === last ? status : undefined }),
|
|
173
|
+
React.createElement(task_views_1.TaskCards, { tasks: started }),
|
|
174
|
+
item.reply.map((text, index) => (React.createElement(markdown_1.Markdown, { key: index, text: text, streaming: item.active && index === item.reply.length - 1 }))),
|
|
175
|
+
!item.active && stopReason === 'error' && errorMessage && React.createElement(callout_1.Callout, { level: "error" }, errorMessage)));
|
|
176
|
+
}
|
|
177
|
+
const { role } = item.message;
|
|
178
|
+
if (role === 'custom') {
|
|
179
|
+
return React.createElement(extension_view_1.CustomMessage, { key: item.key, message: item.message });
|
|
180
|
+
}
|
|
181
|
+
if (role !== 'user') {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
const blocks = message_1.MessageUtil.blocks(item.message);
|
|
185
|
+
const text = message_1.MessageUtil.text(blocks).trim();
|
|
186
|
+
const update = TASK_UPDATE.exec(text);
|
|
187
|
+
if (update) {
|
|
188
|
+
const status = update[3];
|
|
189
|
+
return (React.createElement("button", { key: item.key, type: "button", className: "ta-task-update", onClick: () => onTask(update[1]) },
|
|
190
|
+
React.createElement("span", { className: `ta-status ta-status-${assistant_tasks_1.TASK_DOTS[status]}` }),
|
|
191
|
+
React.createElement("span", { className: "ta-task-update-text" }, t('ta.task.ended', { title: update[2], status: t(`ta.task.${status}`) })),
|
|
192
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.ChevronRight, size: 13, className: "ta-task-update-chevron" })));
|
|
193
|
+
}
|
|
194
|
+
return React.createElement(DoubleUserMessage, { key: item.key, message: item.message, blocks: blocks, text: text });
|
|
195
|
+
};
|
|
166
196
|
return (React.createElement(React.Fragment, null,
|
|
167
|
-
items.map((item, index) => {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
const results = message_1.MessageUtil.results(item.messages);
|
|
171
|
-
const { errorMessage } = ((_a = item.last) !== null && _a !== void 0 ? _a : {});
|
|
172
|
-
const stopReason = message_1.MessageUtil.stopReason(item.last);
|
|
173
|
-
const mood = process_1.ProcessUtil.mood(item, index === lastTurn, waiting);
|
|
174
|
-
const started = web_tasks_1.WebTaskUtil.startedIn(own, origin, starts[index], (_b = starts[index + 1]) !== null && _b !== void 0 ? _b : Number.POSITIVE_INFINITY);
|
|
175
|
-
return (React.createElement(DoubleTurn, { key: item.key, item: item },
|
|
176
|
-
React.createElement(message_list_1.Process, { steps: item.steps, active: item.active, results: results, tools: state.tools, leading: React.createElement(message_list_1.TurnAvatar, { mood: mood }), status: onHead && item === last ? status : undefined }),
|
|
177
|
-
React.createElement(task_views_1.TaskCards, { tasks: started }),
|
|
178
|
-
item.reply.map((text, index) => (React.createElement(markdown_1.Markdown, { key: index, text: text }))),
|
|
179
|
-
!item.active && stopReason === 'error' && errorMessage && React.createElement(callout_1.Callout, { level: "error" }, errorMessage)));
|
|
180
|
-
}
|
|
181
|
-
const { role } = item.message;
|
|
182
|
-
if (role === 'custom') {
|
|
183
|
-
return React.createElement(extension_view_1.CustomMessage, { key: item.key, message: item.message });
|
|
184
|
-
}
|
|
185
|
-
if (role !== 'user') {
|
|
186
|
-
return null;
|
|
187
|
-
}
|
|
188
|
-
const blocks = message_1.MessageUtil.blocks(item.message);
|
|
189
|
-
const text = message_1.MessageUtil.text(blocks).trim();
|
|
190
|
-
const update = TASK_UPDATE.exec(text);
|
|
191
|
-
if (update) {
|
|
192
|
-
const status = update[3];
|
|
193
|
-
return (React.createElement("button", { key: item.key, type: "button", className: "ta-task-update", onClick: () => onTask(update[1]) },
|
|
194
|
-
React.createElement("span", { className: `ta-status ta-status-${assistant_tasks_1.TASK_DOTS[status]}` }),
|
|
195
|
-
React.createElement("span", { className: "ta-task-update-text" }, t('ta.task.ended', { title: update[2], status: t(`ta.task.${status}`) })),
|
|
196
|
-
React.createElement(icon_1.Icon, { icon: lucide_react_1.ChevronRight, size: 13, className: "ta-task-update-chevron" })));
|
|
197
|
-
}
|
|
198
|
-
return React.createElement(DoubleUserMessage, { key: item.key, message: item.message, blocks: blocks, text: text });
|
|
199
|
-
}),
|
|
197
|
+
items.map((item, index) => (React.createElement(React.Fragment, { key: item.key },
|
|
198
|
+
breaks[index] !== undefined && React.createElement(message_footer_1.TimeBreak, { timestamp: breaks[index] }),
|
|
199
|
+
row(item, index)))),
|
|
200
200
|
status && !onHead && React.createElement("div", { className: "ta-run-line" }, status)));
|
|
201
201
|
}
|
|
202
202
|
function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
|
|
@@ -215,7 +215,7 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
|
|
|
215
215
|
const [, notices] = (0, hooks_1.useNotices)();
|
|
216
216
|
const spoken = React.useRef(undefined);
|
|
217
217
|
const box = React.useRef(null);
|
|
218
|
-
const { speak, confirmTasks } = settingsState.settings;
|
|
218
|
+
const { speak, speakTalk, confirmTasks } = settingsState.settings;
|
|
219
219
|
const [name] = (0, hooks_1.usePersisted)(assistant_state_1.ASSISTANT_NAME_STATE);
|
|
220
220
|
const attentions = [
|
|
221
221
|
...state.pendingUi.map(request => ({ source: 'ta', store, request })),
|
|
@@ -238,6 +238,10 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
|
|
|
238
238
|
});
|
|
239
239
|
React.useEffect(() => onMood(mood), [mood, onMood]);
|
|
240
240
|
const reply = lastReply(state.messages, state.start);
|
|
241
|
+
// Said to it by voice, held (its box, or its entry of the navigation): what it answers is heard once, as a
|
|
242
|
+
// conversation by voice, where the user asked for it (Settings.speakTalk, off at first: a reply read out loud
|
|
243
|
+
// where the user only wanted to type by voice is awkward).
|
|
244
|
+
const aloud = React.useRef(false);
|
|
241
245
|
// Reads a new reply out once the run has settled; what was said before the page opened stays quiet.
|
|
242
246
|
React.useEffect(() => {
|
|
243
247
|
if (state.working || !reply || spoken.current === reply.index) {
|
|
@@ -245,7 +249,11 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
|
|
|
245
249
|
}
|
|
246
250
|
const first = spoken.current === undefined;
|
|
247
251
|
spoken.current = reply.index;
|
|
248
|
-
|
|
252
|
+
const audible = voice_1.Voice.canSpeak();
|
|
253
|
+
// A conversation by voice is heard even as the first reply the page shows.
|
|
254
|
+
const answerAloud = aloud.current && audible;
|
|
255
|
+
aloud.current = false;
|
|
256
|
+
if (answerAloud || (!first && speak && audible)) {
|
|
249
257
|
setSpeaking(true);
|
|
250
258
|
voice_1.Voice.speak(reply.text, settingsState.language, () => setSpeaking(false));
|
|
251
259
|
}
|
|
@@ -314,6 +322,17 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
|
|
|
314
322
|
},
|
|
315
323
|
]
|
|
316
324
|
: []),
|
|
325
|
+
...(voice_1.Voice.canSpeak() && voice_1.Voice.canListen()
|
|
326
|
+
? [
|
|
327
|
+
{
|
|
328
|
+
key: 'speakTalk',
|
|
329
|
+
label: t('ta.settings.speakTalk'),
|
|
330
|
+
icon: React.createElement(icon_1.Icon, { icon: lucide_react_1.Mic, size: 16 }),
|
|
331
|
+
detail: t(speakTalk ? 'ta.on' : 'ta.off'),
|
|
332
|
+
run: () => settings.update({ speakTalk: !speakTalk }),
|
|
333
|
+
},
|
|
334
|
+
]
|
|
335
|
+
: []),
|
|
317
336
|
{
|
|
318
337
|
key: 'confirm',
|
|
319
338
|
label: t('ta.assistant.confirmOn'),
|
|
@@ -350,8 +369,11 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
|
|
|
350
369
|
attentions.map(({ source, store: from, request }) => (React.createElement("div", { key: request.id, className: "ta-attention" },
|
|
351
370
|
React.createElement("div", { className: "ta-attention-source" }, source),
|
|
352
371
|
React.createElement(dialog_view_1.DialogView, { request: request, respond: response => from.respondUi(response).catch(() => undefined) })))),
|
|
372
|
+
React.createElement(connection_bar_1.ConnectionBanner, null),
|
|
353
373
|
addons.above,
|
|
354
|
-
React.createElement(composer_1.Composer, { ref: box, store: store, server: bench.server, workspace: bench.workspace, working: state.working, commands: session.settings.commands, cwd: cwd, placeholder: t('ta.assistant.placeholder'), actions: actions, onSending: hush, onError: fail, voiceSends: true,
|
|
374
|
+
React.createElement(composer_1.Composer, { ref: box, store: store, server: bench.server, workspace: bench.workspace, working: state.working, commands: session.settings.commands, cwd: cwd, placeholder: t('ta.assistant.placeholder'), actions: actions, onSending: hush, onError: fail, voiceSends: true, talkPlace: "double", onTalkSent: () => {
|
|
375
|
+
aloud.current = speakTalk;
|
|
376
|
+
}, onListening: on => {
|
|
355
377
|
setListening(on);
|
|
356
378
|
if (on) {
|
|
357
379
|
hush();
|
|
@@ -369,6 +391,9 @@ function AssistantPanel({ onTask }) {
|
|
|
369
391
|
const [mood, setMood] = React.useState('idle');
|
|
370
392
|
const [name] = (0, hooks_1.usePersisted)(assistant_state_1.ASSISTANT_NAME_STATE);
|
|
371
393
|
const taskStates = (0, assistant_hooks_1.useTaskStates)(assistant, state.tasks);
|
|
394
|
+
React.useEffect(() => {
|
|
395
|
+
void assistant.showKept();
|
|
396
|
+
}, [assistant]);
|
|
372
397
|
React.useEffect(() => {
|
|
373
398
|
if (workbench.status === 'online') {
|
|
374
399
|
void assistant.start();
|
|
@@ -396,7 +421,7 @@ function AssistantPanel({ onTask }) {
|
|
|
396
421
|
React.createElement(task_views_1.TasksChip, { tasks: allTasks, onOpen: openTasks }),
|
|
397
422
|
React.createElement(workbench_toggle_1.WorkbenchToggle, null)),
|
|
398
423
|
React.createElement("div", { className: "ta-assistant-body" },
|
|
399
|
-
React.createElement("div", { className: "ta-assistant-chat" }, store ? (React.createElement(Chat, { store: store, tasks: state.tasks, taskStates: taskStates, onTask: openTask, onMood: setMood, onTasks: openTasks })) : (React.createElement("div", { className: "ta-empty" }, state.error ? (React.createElement(callout_1.Callout, { level: "error" }, state.error)) : (React.createElement(React.Fragment, null,
|
|
424
|
+
React.createElement("div", { className: "ta-assistant-chat" }, store ? (React.createElement(Chat, { store: store, tasks: state.tasks, taskStates: taskStates, onTask: openTask, onMood: setMood, onTasks: openTasks })) : (React.createElement("div", { className: "ta-empty" }, state.error ? (React.createElement(callout_1.Callout, { level: "error" }, state.error)) : workbench.offlineShown ? (React.createElement("span", { className: "ta-muted" }, t('ta.assistant.offline'))) : (React.createElement(React.Fragment, null,
|
|
400
425
|
React.createElement("span", { className: "ta-spinner" }),
|
|
401
426
|
" ",
|
|
402
427
|
t('ta.assistant.waking'))))))))));
|
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ClientTool, type SessionState, type SessionStore } from '@celljs/ta-client';
|
|
2
2
|
import { type TaPromptInput, type TaServer, type TaSessionInfo } from '@celljs/ta-protocol';
|
|
3
|
+
import { TaKeptChats } from '../offline/kept-chats-protocol';
|
|
3
4
|
import { type Settings, TaSettings } from '../settings/settings-protocol';
|
|
4
5
|
import { TaState } from '../state/state-protocol';
|
|
5
6
|
import { TaWorkbench } from '../workbench-protocol';
|
|
6
7
|
import { type AssistantAsk, type AssistantState, type AssistantTask, TaAssistant } from './assistant-protocol';
|
|
7
8
|
import { AssistantTaskBook } from './assistant-task-book';
|
|
9
|
+
/** What the double is to hear of a task that ended (finished), and when it ended. */
|
|
10
|
+
interface TaskNote {
|
|
11
|
+
text: string;
|
|
12
|
+
clientMessageId: string;
|
|
13
|
+
at: number;
|
|
14
|
+
}
|
|
8
15
|
export declare class TaAssistantImpl implements TaAssistant {
|
|
9
16
|
protected readonly workbench: TaWorkbench;
|
|
10
17
|
protected readonly persisted: TaState;
|
|
11
18
|
protected readonly settings: TaSettings;
|
|
19
|
+
protected readonly kept: TaKeptChats;
|
|
12
20
|
protected current: AssistantState;
|
|
13
21
|
protected assistant?: SessionStore;
|
|
22
|
+
/** Until the conversation is open (and while the computer cannot be reached): it as this device kept it. */
|
|
23
|
+
protected preview?: SessionStore;
|
|
24
|
+
/** Stops keeping the conversation on the device. */
|
|
25
|
+
protected unkeep?: () => void;
|
|
14
26
|
/** The directory of the conversation with ta, set when it opened: pi's `/new` keeps it. */
|
|
15
27
|
protected cwd?: string;
|
|
16
28
|
protected readonly taskStores: Map<string, SessionStore>;
|
|
@@ -23,6 +35,14 @@ export declare class TaAssistantImpl implements TaAssistant {
|
|
|
23
35
|
protected readonly following: Map<string, () => void>;
|
|
24
36
|
/** The answers the asks wait for, by ask id. */
|
|
25
37
|
protected readonly answers: Map<string, (start: boolean) => void>;
|
|
38
|
+
/**
|
|
39
|
+
* The notes of tasks that ended, by task id, held while the double works and until the task stayed
|
|
40
|
+
* ended a moment (flushNotes): one per task, the last, so that a task that ends again and again does
|
|
41
|
+
* not pile notes up in the double's queue.
|
|
42
|
+
*/
|
|
43
|
+
protected readonly notes: Map<string, TaskNote>;
|
|
44
|
+
protected noteTimer?: ReturnType<typeof setTimeout>;
|
|
45
|
+
protected noteSettleMs: number;
|
|
26
46
|
protected unwatchSettings?: () => void;
|
|
27
47
|
protected unwatchTasks?: () => void;
|
|
28
48
|
protected unwatchOnline?: () => void;
|
|
@@ -39,6 +59,7 @@ export declare class TaAssistantImpl implements TaAssistant {
|
|
|
39
59
|
start(): Promise<void>;
|
|
40
60
|
warm(): Promise<void>;
|
|
41
61
|
store(): SessionStore | undefined;
|
|
62
|
+
showKept(): Promise<void>;
|
|
42
63
|
loadTasks(): Promise<void>;
|
|
43
64
|
/** The tasks other pages change, and the connection: back online (the service restarted, say), what runs is followed again. */
|
|
44
65
|
protected watchTasks(): void;
|
|
@@ -79,6 +100,8 @@ export declare class TaAssistantImpl implements TaAssistant {
|
|
|
79
100
|
protected reopen(store: SessionStore): Promise<void>;
|
|
80
101
|
stop(): Promise<void>;
|
|
81
102
|
restart(): Promise<void>;
|
|
103
|
+
/** Keeps the conversation on the device as it changes, under its file of the time (`restart` gives it another). */
|
|
104
|
+
protected keep(store: SessionStore): void;
|
|
82
105
|
/** The role of ta, whether it asks first, and what the user added to it. */
|
|
83
106
|
protected systemPrompt(): string;
|
|
84
107
|
/** Asking first or not is in the role: the conversation opens again with it, once the double is not at work. */
|
|
@@ -120,6 +143,12 @@ export declare class TaAssistantImpl implements TaAssistant {
|
|
|
120
143
|
* id of the message is the same in each: the time of the task's last answer, by the computer's clock).
|
|
121
144
|
*/
|
|
122
145
|
protected finished(id: string, state: SessionState): void;
|
|
146
|
+
/**
|
|
147
|
+
* Sends the notes of the tasks that stayed ended a moment, once the double is not at work: what it
|
|
148
|
+
* did not hear yet waits here rather than in its queue, where a task that ended again would add one more.
|
|
149
|
+
*/
|
|
150
|
+
protected flushNotes(): void;
|
|
123
151
|
protected update(change: Partial<AssistantState>): void;
|
|
124
152
|
}
|
|
153
|
+
export {};
|
|
125
154
|
//# sourceMappingURL=assistant.d.ts.map
|
|
@@ -11,7 +11,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.TaAssistantImpl = void 0;
|
|
13
13
|
const core_1 = require("@celljs/core");
|
|
14
|
+
const ta_client_1 = require("@celljs/ta-client");
|
|
14
15
|
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
16
|
+
const kept_chats_protocol_1 = require("../offline/kept-chats-protocol");
|
|
15
17
|
const settings_protocol_1 = require("../settings/settings-protocol");
|
|
16
18
|
const state_protocol_1 = require("../state/state-protocol");
|
|
17
19
|
const workbench_protocol_1 = require("../workbench-protocol");
|
|
@@ -21,6 +23,8 @@ const assistant_state_1 = require("./assistant-state");
|
|
|
21
23
|
const assistant_task_book_1 = require("./assistant-task-book");
|
|
22
24
|
const assistant_task_util_1 = require("./assistant-task-util");
|
|
23
25
|
const { FILE, TASKS, PROMPT, ASKING } = assistant_state_1.AssistantStates;
|
|
26
|
+
/** How long a task stays ended before the double hears of it: an agent that goes on by itself ends and runs again within seconds. */
|
|
27
|
+
const NOTE_SETTLE_MS = 5000;
|
|
24
28
|
let TaAssistantImpl = class TaAssistantImpl {
|
|
25
29
|
constructor() {
|
|
26
30
|
this.current = { ready: false, tasks: [], asks: [] };
|
|
@@ -32,6 +36,13 @@ let TaAssistantImpl = class TaAssistantImpl {
|
|
|
32
36
|
this.following = new Map();
|
|
33
37
|
/** The answers the asks wait for, by ask id. */
|
|
34
38
|
this.answers = new Map();
|
|
39
|
+
/**
|
|
40
|
+
* The notes of tasks that ended, by task id, held while the double works and until the task stayed
|
|
41
|
+
* ended a moment (flushNotes): one per task, the last, so that a task that ends again and again does
|
|
42
|
+
* not pile notes up in the double's queue.
|
|
43
|
+
*/
|
|
44
|
+
this.notes = new Map();
|
|
45
|
+
this.noteSettleMs = NOTE_SETTLE_MS;
|
|
35
46
|
this.asked = 0;
|
|
36
47
|
this.listeners = new Set();
|
|
37
48
|
}
|
|
@@ -53,6 +64,11 @@ let TaAssistantImpl = class TaAssistantImpl {
|
|
|
53
64
|
(_a = this.unwatchSettings) !== null && _a !== void 0 ? _a : (this.unwatchSettings = this.settings.subscribe(state => this.settingsChanged(state.settings)));
|
|
54
65
|
(_b = this.starting) !== null && _b !== void 0 ? _b : (this.starting = this.open().catch(error => {
|
|
55
66
|
this.starting = undefined;
|
|
67
|
+
if (ta_client_1.TaRemoteError.isConnectionLost(error)) {
|
|
68
|
+
// No failure to show: it wakes once the connection is back (a moment after, not in a loop).
|
|
69
|
+
setTimeout(() => void this.workbench.connected().then(() => (this.starting || this.assistant ? undefined : this.start()), () => undefined), 1000);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
56
72
|
this.update({ error: error instanceof Error ? error.message : String(error) });
|
|
57
73
|
}));
|
|
58
74
|
return this.starting;
|
|
@@ -63,7 +79,17 @@ let TaAssistantImpl = class TaAssistantImpl {
|
|
|
63
79
|
}
|
|
64
80
|
}
|
|
65
81
|
store() {
|
|
66
|
-
|
|
82
|
+
var _a;
|
|
83
|
+
return (_a = this.assistant) !== null && _a !== void 0 ? _a : this.preview;
|
|
84
|
+
}
|
|
85
|
+
async showKept() {
|
|
86
|
+
const file = this.assistant || this.preview ? undefined : await this.persisted.load(FILE);
|
|
87
|
+
const initial = file ? await this.kept.read(file).catch(() => undefined) : undefined;
|
|
88
|
+
if (initial && !this.assistant && !this.preview) {
|
|
89
|
+
// Under its file: it is of no session until the conversation opens, which takes over what it shows.
|
|
90
|
+
this.preview = this.workbench.createStore(file, { initial });
|
|
91
|
+
this.update({});
|
|
92
|
+
}
|
|
67
93
|
}
|
|
68
94
|
async loadTasks() {
|
|
69
95
|
this.watchTasks();
|
|
@@ -145,6 +171,9 @@ let TaAssistantImpl = class TaAssistantImpl {
|
|
|
145
171
|
// Opening (again, after a reconnect found it gone): sent once it is open.
|
|
146
172
|
await this.starting;
|
|
147
173
|
const store = this.assistant;
|
|
174
|
+
if (!store && this.workbench.state.status !== 'online') {
|
|
175
|
+
throw ta_client_1.TaRemoteError.notConnected();
|
|
176
|
+
}
|
|
148
177
|
if (!store) {
|
|
149
178
|
throw new Error('Ta is not ready yet.');
|
|
150
179
|
}
|
|
@@ -296,6 +325,18 @@ let TaAssistantImpl = class TaAssistantImpl {
|
|
|
296
325
|
this.persisted.set(FILE, sessionFile);
|
|
297
326
|
}
|
|
298
327
|
}
|
|
328
|
+
/** Keeps the conversation on the device as it changes, under its file of the time (`restart` gives it another). */
|
|
329
|
+
keep(store) {
|
|
330
|
+
var _a;
|
|
331
|
+
(_a = this.unkeep) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
332
|
+
let file = this.sessionFile;
|
|
333
|
+
this.unkeep = this.kept.follow(store, () => {
|
|
334
|
+
if (this.assistant === store) {
|
|
335
|
+
file = this.sessionFile;
|
|
336
|
+
}
|
|
337
|
+
return file;
|
|
338
|
+
});
|
|
339
|
+
}
|
|
299
340
|
/** The role of ta, whether it asks first, and what the user added to it. */
|
|
300
341
|
systemPrompt() {
|
|
301
342
|
return (0, assistant_role_1.assistantRole)(this.settings.state.settings.confirmTasks, this.prompt);
|
|
@@ -328,8 +369,8 @@ let TaAssistantImpl = class TaAssistantImpl {
|
|
|
328
369
|
* trip to ta serve, which over a relay or a phone's network takes long.
|
|
329
370
|
*/
|
|
330
371
|
async open() {
|
|
331
|
-
var _a;
|
|
332
|
-
var
|
|
372
|
+
var _a, _b;
|
|
373
|
+
var _c;
|
|
333
374
|
this.watchTasks();
|
|
334
375
|
const clientTools = this.clientTools();
|
|
335
376
|
const [tasks, file, wasAsking, sessions] = await Promise.all([
|
|
@@ -354,7 +395,7 @@ let TaAssistantImpl = class TaAssistantImpl {
|
|
|
354
395
|
if (!info) {
|
|
355
396
|
this.persisted.set(ASKING, asking);
|
|
356
397
|
const options = {
|
|
357
|
-
cwd: (
|
|
398
|
+
cwd: (_c = (_a = this.workbench.state.server) === null || _a === void 0 ? void 0 : _a.cwd) !== null && _c !== void 0 ? _c : '.',
|
|
358
399
|
appendSystemPrompt: this.systemPrompt(),
|
|
359
400
|
clientTools: clientTools.map(tool => tool.definition),
|
|
360
401
|
};
|
|
@@ -372,11 +413,20 @@ let TaAssistantImpl = class TaAssistantImpl {
|
|
|
372
413
|
}
|
|
373
414
|
const { sessionId } = info;
|
|
374
415
|
this.cwd = info.cwd;
|
|
375
|
-
|
|
416
|
+
// What the device kept shows on: the messages that are the same keep their objects.
|
|
417
|
+
const store = this.workbench.createStore(sessionId, { clientTools, initial: (_b = this.preview) === null || _b === void 0 ? void 0 : _b.state });
|
|
376
418
|
await Promise.all([named ? this.server.setSessionName(sessionId, 'Ta') : undefined, this.applyModel(sessionId, info.model), store.attach()]);
|
|
377
419
|
store.onGone(() => void this.recover(store));
|
|
420
|
+
store.subscribe(state => {
|
|
421
|
+
if (!state.working && this.assistant === store) {
|
|
422
|
+
this.flushNotes();
|
|
423
|
+
}
|
|
424
|
+
});
|
|
378
425
|
this.assistant = store;
|
|
426
|
+
this.preview = undefined;
|
|
427
|
+
this.keep(store);
|
|
379
428
|
this.update({ ready: true, error: undefined });
|
|
429
|
+
this.flushNotes();
|
|
380
430
|
await this.followRunning(sessions);
|
|
381
431
|
}
|
|
382
432
|
/**
|
|
@@ -519,6 +569,8 @@ let TaAssistantImpl = class TaAssistantImpl {
|
|
|
519
569
|
return;
|
|
520
570
|
}
|
|
521
571
|
if (state.working) {
|
|
572
|
+
// Not ended after all: the double hears of it when it ends again.
|
|
573
|
+
this.notes.delete(id);
|
|
522
574
|
if (task.status !== 'running') {
|
|
523
575
|
this.book.change(id, { status: 'running', endedAt: undefined, result: undefined });
|
|
524
576
|
}
|
|
@@ -535,7 +587,34 @@ let TaAssistantImpl = class TaAssistantImpl {
|
|
|
535
587
|
const { status, result, endedAt, key } = assistant_task_util_1.AssistantTaskUtil.outcome(state);
|
|
536
588
|
this.book.change(id, { status, endedAt: endedAt !== null && endedAt !== void 0 ? endedAt : Date.now(), result });
|
|
537
589
|
this.update({ lastFinished: Date.now() });
|
|
538
|
-
|
|
590
|
+
this.notes.set(id, { text: assistant_task_util_1.AssistantTaskUtil.updateNote(this.book.get(id)), clientMessageId: `task-update:${id}:${key}`, at: Date.now() });
|
|
591
|
+
this.flushNotes();
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Sends the notes of the tasks that stayed ended a moment, once the double is not at work: what it
|
|
595
|
+
* did not hear yet waits here rather than in its queue, where a task that ended again would add one more.
|
|
596
|
+
*/
|
|
597
|
+
flushNotes() {
|
|
598
|
+
clearTimeout(this.noteTimer);
|
|
599
|
+
this.noteTimer = undefined;
|
|
600
|
+
const store = this.assistant;
|
|
601
|
+
if (!this.notes.size || !store || store.state.working) {
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
const now = Date.now();
|
|
605
|
+
let next = Number.POSITIVE_INFINITY;
|
|
606
|
+
for (const [id, note] of this.notes) {
|
|
607
|
+
const wait = note.at + this.noteSettleMs - now;
|
|
608
|
+
if (wait > 0) {
|
|
609
|
+
next = Math.min(next, wait);
|
|
610
|
+
continue;
|
|
611
|
+
}
|
|
612
|
+
this.notes.delete(id);
|
|
613
|
+
void this.send(note.text, 'followUp', note.clientMessageId).catch(() => undefined);
|
|
614
|
+
}
|
|
615
|
+
if (next !== Number.POSITIVE_INFINITY) {
|
|
616
|
+
this.noteTimer = setTimeout(() => this.flushNotes(), next);
|
|
617
|
+
}
|
|
539
618
|
}
|
|
540
619
|
update(change) {
|
|
541
620
|
this.current = { ...this.current, ...change };
|
|
@@ -557,6 +636,10 @@ __decorate([
|
|
|
557
636
|
(0, core_1.Autowired)(settings_protocol_1.TaSettings),
|
|
558
637
|
__metadata("design:type", Object)
|
|
559
638
|
], TaAssistantImpl.prototype, "settings", void 0);
|
|
639
|
+
__decorate([
|
|
640
|
+
(0, core_1.Autowired)(kept_chats_protocol_1.TaKeptChats),
|
|
641
|
+
__metadata("design:type", Object)
|
|
642
|
+
], TaAssistantImpl.prototype, "kept", void 0);
|
|
560
643
|
exports.TaAssistantImpl = TaAssistantImpl = __decorate([
|
|
561
644
|
(0, core_1.Component)(assistant_protocol_1.TaAssistant)
|
|
562
645
|
], TaAssistantImpl);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { WebTask, WebTaskEntry } from '../extension/web-extension-api';
|
|
2
|
+
import type { WebTask, WebTaskEntry, WebTaskRemoval } from '../extension/web-extension-api';
|
|
3
3
|
import { type Translate } from '../i18n/use-t';
|
|
4
4
|
import type { AssistantAsk } from './assistant-protocol';
|
|
5
5
|
/** The dot of a status, in the colors of the steps of a turn. */
|
|
@@ -23,13 +23,47 @@ export declare const TaskCard: React.MemoExoticComponent<({ task }: {
|
|
|
23
23
|
export declare function TaskCards({ tasks }: {
|
|
24
24
|
tasks: WebTaskEntry[];
|
|
25
25
|
}): React.JSX.Element | null;
|
|
26
|
-
/**
|
|
27
|
-
export
|
|
26
|
+
/** What a list of tasks does with its rows: the same functions for every row, so that a row draws again only for its own change. */
|
|
27
|
+
export interface TaskListActions {
|
|
28
|
+
/** Deletes it once the user agrees. */
|
|
29
|
+
remove(task: WebTaskEntry): void;
|
|
30
|
+
/** The list starts selecting, with it chosen. */
|
|
31
|
+
select(key: string): void;
|
|
32
|
+
/** Chooses it, or no longer, while the list selects. */
|
|
33
|
+
toggle(key: string): void;
|
|
34
|
+
}
|
|
35
|
+
export interface TaskRowProps {
|
|
28
36
|
task: WebTaskEntry;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
|
|
37
|
+
actions?: TaskListActions;
|
|
38
|
+
/** The list selects: a tap chooses the row, `checked` once chosen. */
|
|
39
|
+
selecting?: boolean;
|
|
40
|
+
checked?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A task in a list: its face, its title and what it is at, its time. On a phone a swipe to the left shows
|
|
44
|
+
* Delete behind it, as the other lists; its menu starts selecting several, to delete them at once.
|
|
45
|
+
*/
|
|
46
|
+
export declare const TaskRow: React.MemoExoticComponent<({ task, actions, selecting, checked }: TaskRowProps) => React.JSX.Element>;
|
|
47
|
+
/**
|
|
48
|
+
* Which tasks of a list are chosen while it selects (undefined while it does not), and what its rows do: a
|
|
49
|
+
* swipe deletes one, the menu of one starts selecting, and the bar deletes those chosen, asked once. Those
|
|
50
|
+
* gone from the list are no longer chosen; with none left that can be deleted, it stops selecting.
|
|
51
|
+
*/
|
|
52
|
+
export declare function useTaskSelection(tasks: readonly WebTaskEntry[], remove: (tasks: readonly WebTaskRemoval[]) => Promise<boolean>): {
|
|
53
|
+
actions: TaskListActions;
|
|
54
|
+
selecting: boolean;
|
|
55
|
+
isChosen: (task: WebTaskEntry) => boolean;
|
|
56
|
+
selected: WebTaskEntry[];
|
|
57
|
+
removable: WebTaskEntry[];
|
|
58
|
+
selectAll: (all: boolean) => void;
|
|
59
|
+
done: () => void;
|
|
60
|
+
/** Deletes those chosen once the user agrees, and stops selecting. */
|
|
61
|
+
removeSelected: () => Promise<void>;
|
|
62
|
+
};
|
|
63
|
+
/** Every task: what waits for the user, what runs, then what ended, the latest first. `onRemove` deletes some once the user agrees (useRemoveTasks). */
|
|
64
|
+
export declare function TaskBoardList({ tasks, onRemove }: {
|
|
32
65
|
tasks: readonly WebTaskEntry[];
|
|
66
|
+
onRemove(tasks: readonly WebTaskRemoval[]): Promise<boolean>;
|
|
33
67
|
}): React.JSX.Element;
|
|
34
68
|
/** In the head of the double: how many run and how many wait for the user; the tasks open on a click. */
|
|
35
69
|
export declare function TasksChip({ tasks, onOpen }: {
|