@celljs/ta-web 4.11.0 → 4.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/assistant/assistant-extension.js +14 -0
- package/esm/browser/assistant/assistant-initiative.d.ts +27 -0
- package/esm/browser/assistant/assistant-initiative.js +76 -0
- package/esm/browser/assistant/assistant-task-source.d.ts +7 -0
- package/esm/browser/assistant/assistant-task-source.js +12 -2
- package/esm/browser/assistant/assistant-view.js +10 -6
- package/esm/browser/assistant/assistant.d.ts +5 -0
- package/esm/browser/assistant/assistant.js +25 -6
- package/esm/browser/chat/chat-view.js +6 -5
- package/esm/browser/components/app-nav.d.ts +3 -1
- package/esm/browser/components/app-nav.js +5 -2
- package/esm/browser/components/app-view.js +26 -13
- package/esm/browser/components/asks-badge.d.ts +5 -0
- package/esm/browser/components/asks-badge.js +8 -0
- package/esm/browser/components/chat-asks.d.ts +46 -0
- package/esm/browser/components/chat-asks.js +101 -0
- package/esm/browser/components/chat-list.d.ts +7 -1
- package/esm/browser/components/chat-list.js +46 -17
- package/esm/browser/components/composer-addon-util.d.ts +11 -0
- package/esm/browser/components/composer-addon-util.js +40 -0
- package/esm/browser/components/composer-addons.d.ts +1 -7
- package/esm/browser/components/composer-addons.js +1 -27
- package/esm/browser/components/composer-box.d.ts +1 -0
- package/esm/browser/components/composer-box.js +50 -28
- package/esm/browser/components/composer.d.ts +10 -1
- package/esm/browser/components/composer.js +61 -22
- package/esm/browser/components/connection-bar.js +31 -12
- package/esm/browser/components/conversation-scroll-hooks.d.ts +16 -0
- package/esm/browser/components/conversation-scroll-hooks.js +98 -0
- package/esm/browser/components/conversation-scroll-util.d.ts +35 -0
- package/esm/browser/components/conversation-scroll-util.js +74 -0
- package/esm/browser/components/conversation-scroll.d.ts +57 -33
- package/esm/browser/components/conversation-scroll.js +188 -123
- package/esm/browser/components/discover-view.js +5 -1
- package/esm/browser/components/earlier-messages.d.ts +10 -3
- package/esm/browser/components/earlier-messages.js +14 -8
- package/esm/browser/components/face.d.ts +24 -0
- package/esm/browser/components/face.js +42 -0
- package/esm/browser/components/folder-picker.d.ts +2 -0
- package/esm/browser/components/folder-picker.js +7 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/markdown.js +4 -2
- package/esm/browser/components/media.js +25 -11
- package/esm/browser/components/mermaid-view.js +45 -3
- package/esm/browser/components/message-actions.js +1 -0
- package/esm/browser/components/message-footer.d.ts +4 -0
- package/esm/browser/components/message-footer.js +8 -1
- package/esm/browser/components/message-list.d.ts +15 -1
- package/esm/browser/components/message-list.js +204 -41
- package/esm/browser/components/phone-shell.d.ts +7 -2
- package/esm/browser/components/phone-shell.js +9 -3
- package/esm/browser/components/relay-services.d.ts +24 -0
- package/esm/browser/components/relay-services.js +249 -0
- package/esm/browser/components/relay-view.js +17 -1
- package/esm/browser/components/remote-hosts.js +1 -1
- package/esm/browser/components/session-view.d.ts +3 -1
- package/esm/browser/components/session-view.js +23 -7
- package/esm/browser/components/settings-controls.js +3 -3
- package/esm/browser/components/settings-parts.js +13 -1
- package/esm/browser/components/stop-times.d.ts +47 -0
- package/esm/browser/components/stop-times.js +81 -0
- package/esm/browser/components/ta-avatar.js +6 -0
- package/esm/browser/components/tool-result.d.ts +13 -0
- package/esm/browser/components/tool-result.js +138 -0
- package/esm/browser/components/tool-view.js +5 -15
- package/esm/browser/components/use-stop-times.d.ts +3 -0
- package/esm/browser/components/use-stop-times.js +17 -0
- package/esm/browser/components/web-composer.js +2 -1
- package/esm/browser/device/photo-picker.d.ts +14 -0
- package/esm/browser/device/photo-picker.js +48 -0
- package/esm/browser/device/row-swipe.d.ts +2 -0
- package/esm/browser/device/row-swipe.js +8 -2
- package/esm/browser/device/sheet-swipe.d.ts +1 -1
- package/esm/browser/device/sheet-swipe.js +17 -3
- package/esm/browser/extension/extension-view.d.ts +3 -1
- package/esm/browser/extension/extension-view.js +7 -0
- package/esm/browser/extension/icons.js +10 -1
- package/esm/browser/extension/web-api-components.d.ts +21 -3
- package/esm/browser/extension/web-api-contributions.d.ts +128 -0
- package/esm/browser/extension/web-extension-api.d.ts +45 -48
- package/esm/browser/extension/web-extension-context.d.ts +6 -1
- package/esm/browser/extension/web-extension-context.js +72 -7
- package/esm/browser/extension/web-extension-protocol.d.ts +18 -2
- package/esm/browser/extension/web-extension-protocol.js +2 -0
- package/esm/browser/extension/web-extension-run.d.ts +3 -2
- package/esm/browser/extension/web-extension-run.js +3 -0
- package/esm/browser/extension/web-extensions.d.ts +2 -8
- package/esm/browser/extension/web-extensions.js +12 -35
- package/esm/browser/extension/web-page-list.d.ts +25 -0
- package/esm/browser/extension/web-page-list.js +35 -0
- package/esm/browser/extension/web-session-notices.d.ts +6 -1
- package/esm/browser/extension/web-session-notices.js +30 -4
- package/esm/browser/extension/web-sharing.d.ts +5 -2
- package/esm/browser/extension/web-sharing.js +10 -1
- package/esm/browser/i18n/locales.d.ts +77 -1
- package/esm/browser/i18n/messages.d.ts +76 -0
- package/esm/browser/i18n/messages.js +154 -2
- package/esm/browser/links/links-protocol.d.ts +2 -0
- package/esm/browser/links/links.d.ts +7 -2
- package/esm/browser/links/links.js +16 -9
- package/esm/browser/markdown/code-renderers.d.ts +4 -0
- package/esm/browser/markdown/code-renderers.js +4 -0
- package/esm/browser/markdown/lazy.d.ts +8 -0
- package/esm/browser/markdown/lazy.js +35 -0
- package/esm/browser/markdown/mermaid.d.ts +15 -3
- package/esm/browser/markdown/mermaid.js +45 -6
- package/esm/browser/notices/notices-protocol.d.ts +5 -0
- package/esm/browser/notices/notices.d.ts +19 -0
- package/esm/browser/notices/notices.js +85 -2
- package/esm/browser/notices/session-notices.d.ts +5 -2
- package/esm/browser/notices/session-notices.js +10 -1
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +2 -1
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +53 -0
- package/esm/browser/style/device.js +3 -0
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +27 -9
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +5 -0
- package/esm/browser/style/phone.d.ts +1 -1
- package/esm/browser/style/phone.js +2 -0
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +16 -3
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +19 -0
- package/esm/browser/util/desktop.d.ts +18 -1
- package/esm/browser/util/desktop.js +13 -0
- package/esm/browser/util/frame.d.ts +2 -0
- package/esm/browser/util/frame.js +2 -0
- package/esm/browser/util/process.d.ts +69 -2
- package/esm/browser/util/process.js +163 -8
- package/esm/browser/util/progress.d.ts +6 -1
- package/esm/browser/util/progress.js +11 -2
- package/esm/browser/util/scroll-rest.d.ts +10 -0
- package/esm/browser/util/scroll-rest.js +44 -0
- package/esm/browser/util/tool-result.d.ts +32 -0
- package/esm/browser/util/tool-result.js +85 -0
- package/esm/browser/util/tool.js +7 -0
- package/lib/browser/assistant/assistant-extension.js +14 -0
- package/lib/browser/assistant/assistant-initiative.d.ts +28 -0
- package/lib/browser/assistant/assistant-initiative.js +80 -0
- package/lib/browser/assistant/assistant-task-source.d.ts +7 -0
- package/lib/browser/assistant/assistant-task-source.js +12 -2
- package/lib/browser/assistant/assistant-view.js +8 -4
- package/lib/browser/assistant/assistant.d.ts +5 -0
- package/lib/browser/assistant/assistant.js +24 -5
- package/lib/browser/chat/chat-view.js +6 -5
- package/lib/browser/components/app-nav.d.ts +3 -1
- package/lib/browser/components/app-nav.js +5 -2
- package/lib/browser/components/app-view.js +25 -12
- package/lib/browser/components/asks-badge.d.ts +6 -0
- package/lib/browser/components/asks-badge.js +44 -0
- package/lib/browser/components/chat-asks.d.ts +47 -0
- package/lib/browser/components/chat-asks.js +104 -0
- package/lib/browser/components/chat-list.d.ts +7 -1
- package/lib/browser/components/chat-list.js +46 -17
- package/lib/browser/components/composer-addon-util.d.ts +12 -0
- package/lib/browser/components/composer-addon-util.js +76 -0
- package/lib/browser/components/composer-addons.d.ts +1 -7
- package/lib/browser/components/composer-addons.js +2 -29
- package/lib/browser/components/composer-box.d.ts +1 -0
- package/lib/browser/components/composer-box.js +48 -26
- package/lib/browser/components/composer.d.ts +10 -1
- package/lib/browser/components/composer.js +61 -21
- package/lib/browser/components/connection-bar.js +30 -11
- package/lib/browser/components/conversation-scroll-hooks.d.ts +17 -0
- package/lib/browser/components/conversation-scroll-hooks.js +135 -0
- package/lib/browser/components/conversation-scroll-util.d.ts +36 -0
- package/lib/browser/components/conversation-scroll-util.js +78 -0
- package/lib/browser/components/conversation-scroll.d.ts +57 -33
- package/lib/browser/components/conversation-scroll.js +189 -158
- package/lib/browser/components/discover-view.js +5 -1
- package/lib/browser/components/earlier-messages.d.ts +10 -3
- package/lib/browser/components/earlier-messages.js +16 -9
- package/lib/browser/components/face.d.ts +25 -0
- package/lib/browser/components/face.js +79 -0
- package/lib/browser/components/folder-picker.d.ts +2 -0
- package/lib/browser/components/folder-picker.js +7 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/markdown.js +3 -1
- package/lib/browser/components/media.js +24 -10
- package/lib/browser/components/mermaid-view.js +45 -3
- package/lib/browser/components/message-actions.js +1 -0
- package/lib/browser/components/message-footer.d.ts +4 -0
- package/lib/browser/components/message-footer.js +8 -0
- package/lib/browser/components/message-list.d.ts +15 -1
- package/lib/browser/components/message-list.js +200 -35
- package/lib/browser/components/phone-shell.d.ts +7 -2
- package/lib/browser/components/phone-shell.js +9 -3
- package/lib/browser/components/relay-services.d.ts +25 -0
- package/lib/browser/components/relay-services.js +286 -0
- package/lib/browser/components/relay-view.js +17 -1
- package/lib/browser/components/remote-hosts.js +1 -1
- package/lib/browser/components/session-view.d.ts +3 -1
- package/lib/browser/components/session-view.js +23 -7
- package/lib/browser/components/settings-controls.js +3 -3
- package/lib/browser/components/settings-parts.js +13 -1
- package/lib/browser/components/stop-times.d.ts +48 -0
- package/lib/browser/components/stop-times.js +85 -0
- package/lib/browser/components/ta-avatar.js +6 -0
- package/lib/browser/components/tool-result.d.ts +14 -0
- package/lib/browser/components/tool-result.js +175 -0
- package/lib/browser/components/tool-view.js +10 -20
- package/lib/browser/components/use-stop-times.d.ts +4 -0
- package/lib/browser/components/use-stop-times.js +53 -0
- package/lib/browser/components/web-composer.js +2 -1
- package/lib/browser/device/photo-picker.d.ts +15 -0
- package/lib/browser/device/photo-picker.js +51 -0
- package/lib/browser/device/row-swipe.d.ts +2 -0
- package/lib/browser/device/row-swipe.js +8 -2
- package/lib/browser/device/sheet-swipe.d.ts +1 -1
- package/lib/browser/device/sheet-swipe.js +17 -3
- package/lib/browser/extension/extension-view.d.ts +3 -1
- package/lib/browser/extension/extension-view.js +8 -1
- package/lib/browser/extension/icons.js +9 -0
- package/lib/browser/extension/web-api-components.d.ts +21 -3
- package/lib/browser/extension/web-api-contributions.d.ts +128 -0
- package/lib/browser/extension/web-extension-api.d.ts +45 -48
- package/lib/browser/extension/web-extension-context.d.ts +6 -1
- package/lib/browser/extension/web-extension-context.js +73 -8
- package/lib/browser/extension/web-extension-protocol.d.ts +18 -2
- package/lib/browser/extension/web-extension-protocol.js +2 -0
- package/lib/browser/extension/web-extension-run.d.ts +3 -2
- package/lib/browser/extension/web-extension-run.js +3 -0
- package/lib/browser/extension/web-extensions.d.ts +2 -8
- package/lib/browser/extension/web-extensions.js +12 -35
- package/lib/browser/extension/web-page-list.d.ts +26 -0
- package/lib/browser/extension/web-page-list.js +39 -0
- package/lib/browser/extension/web-session-notices.d.ts +6 -1
- package/lib/browser/extension/web-session-notices.js +30 -4
- package/lib/browser/extension/web-sharing.d.ts +5 -2
- package/lib/browser/extension/web-sharing.js +10 -1
- package/lib/browser/i18n/locales.d.ts +77 -1
- package/lib/browser/i18n/messages.d.ts +76 -0
- package/lib/browser/i18n/messages.js +154 -2
- package/lib/browser/links/links-protocol.d.ts +2 -0
- package/lib/browser/links/links.d.ts +7 -2
- package/lib/browser/links/links.js +16 -9
- package/lib/browser/markdown/code-renderers.d.ts +4 -0
- package/lib/browser/markdown/code-renderers.js +5 -1
- package/lib/browser/markdown/lazy.d.ts +8 -0
- package/lib/browser/markdown/lazy.js +37 -1
- package/lib/browser/markdown/mermaid.d.ts +15 -3
- package/lib/browser/markdown/mermaid.js +44 -5
- package/lib/browser/notices/notices-protocol.d.ts +5 -0
- package/lib/browser/notices/notices.d.ts +19 -0
- package/lib/browser/notices/notices.js +84 -1
- package/lib/browser/notices/session-notices.d.ts +5 -2
- package/lib/browser/notices/session-notices.js +10 -1
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +2 -1
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +53 -0
- package/lib/browser/style/device.js +3 -0
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +27 -9
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +5 -0
- package/lib/browser/style/phone.d.ts +1 -1
- package/lib/browser/style/phone.js +2 -0
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +16 -3
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +19 -0
- package/lib/browser/util/desktop.d.ts +18 -1
- package/lib/browser/util/desktop.js +13 -0
- package/lib/browser/util/frame.d.ts +2 -0
- package/lib/browser/util/frame.js +2 -0
- package/lib/browser/util/process.d.ts +69 -2
- package/lib/browser/util/process.js +165 -9
- package/lib/browser/util/progress.d.ts +6 -1
- package/lib/browser/util/progress.js +11 -2
- package/lib/browser/util/scroll-rest.d.ts +11 -0
- package/lib/browser/util/scroll-rest.js +47 -0
- package/lib/browser/util/tool-result.d.ts +33 -0
- package/lib/browser/util/tool-result.js +88 -0
- package/lib/browser/util/tool.js +7 -0
- package/package.json +7 -7
|
@@ -6,7 +6,7 @@ import { REMOVED_CHATS } from '../chat/chat-protocol.js';
|
|
|
6
6
|
import { ChatView, useChat } from '../chat/chat-view.js';
|
|
7
7
|
import { useDevice } from '../device/device.js';
|
|
8
8
|
import { LaunchScreenUtil } from '../device/launch-screen.js';
|
|
9
|
-
import { MessageRenderers, SessionAvatars, SessionMenus, ToolRenderers } from '../extension/extension-view.js';
|
|
9
|
+
import { LoadedExtensions, MessageRenderers, SessionAvatars, SessionMenus, ToolRenderers } from '../extension/extension-view.js';
|
|
10
10
|
import { WebCwdUtil } from '../extension/web-extension-protocol.js';
|
|
11
11
|
import { TaFiles } from '../files/files-protocol.js';
|
|
12
12
|
import { useCodeScan, useNotices, useOpenLink, usePersisted, useSettings, useWebExtensions, useWorkbench } from '../hooks.js';
|
|
@@ -20,6 +20,7 @@ import { PageView, Rail, SidebarView, useNavigation } from './app-nav.js';
|
|
|
20
20
|
import { CARDS_ID, EDITOR, FIRST_SIDE, LOGIN_LATER, RAIL, SIDE, SIDEBAR, useDrawerSwipe, useKeys, useRefresh, useRight, useTitlebarColor, useWorkbenchCards, } from './app-shell-hooks.js';
|
|
21
21
|
import { AuthUtil, LoginPage, useAuthProviders } from './auth-view.js';
|
|
22
22
|
import { BoardSurface, useSurfaces } from './board.js';
|
|
23
|
+
import { ChatAskUtil, LET_GO_ASKS } from './chat-asks.js';
|
|
23
24
|
import { ChatIconsProvider, ChatIconUtil } from './chat-icon.js';
|
|
24
25
|
import { BY_DIRECTORY, ChatListUtil, FOLDED, PINNED } from './chat-list.js';
|
|
25
26
|
import { ChatSeenUtil, SEEN_CHATS } from './chat-seen.js';
|
|
@@ -36,6 +37,7 @@ import { KeptPages } from './kept-pages.js';
|
|
|
36
37
|
import { LauncherSurface } from './launcher-surface.js';
|
|
37
38
|
import { OpenLink } from './link.js';
|
|
38
39
|
import { LinkDialog } from './link-dialog.js';
|
|
40
|
+
import { ListSkeleton } from './list-skeleton.js';
|
|
39
41
|
import { MeView } from './me-view.js';
|
|
40
42
|
import { FileUrls } from './media.js';
|
|
41
43
|
import { DISCOVER, ME_TAB, phoneTabs } from './nav-places.js';
|
|
@@ -69,6 +71,7 @@ function AppShell() {
|
|
|
69
71
|
const [chatsByDirectory, setChatsByDirectory] = usePersisted(BY_DIRECTORY);
|
|
70
72
|
const [foldedChats, setFoldedChats] = usePersisted(FOLDED);
|
|
71
73
|
const [pinnedChats, setPinnedChats] = usePersisted(PINNED);
|
|
74
|
+
const [letGoAsks, setLetGoAsks] = usePersisted(LET_GO_ASKS);
|
|
72
75
|
const [navOpen, setNavOpen] = React.useState(false);
|
|
73
76
|
const layout = useDevice(device => device.layout);
|
|
74
77
|
const touch = useDevice(device => device.touch);
|
|
@@ -161,7 +164,7 @@ function AppShell() {
|
|
|
161
164
|
React.useEffect(() => {
|
|
162
165
|
host.setSessionSwitcher(async (session, opening) => {
|
|
163
166
|
// In front at once, while it opens.
|
|
164
|
-
const shown = chat.show(session, opening);
|
|
167
|
+
const shown = typeof session === 'object' && 'sessionFile' in session ? chat.resume(session.sessionFile) : chat.show(session, opening);
|
|
165
168
|
setNavOpen(false);
|
|
166
169
|
setSurface(undefined);
|
|
167
170
|
setSettings(undefined);
|
|
@@ -211,7 +214,9 @@ function AppShell() {
|
|
|
211
214
|
const view = extensions.views.find(candidate => candidate.id === page && candidate.location === 'page');
|
|
212
215
|
const sideViews = SideListUtil.sidebarViews(extensions.views);
|
|
213
216
|
const sideView = sideId === FIRST_SIDE ? sideViews[0] : sideViews.find(candidate => candidate.id === sideId);
|
|
214
|
-
|
|
217
|
+
// The first start, nothing kept: the double's list may still come, rather than the chats shown a moment before it.
|
|
218
|
+
const sideComing = sideId === FIRST_SIDE && !sideView && !extensions.loaded;
|
|
219
|
+
const side = sideView ? sideView.id : sideComing ? FIRST_SIDE : '';
|
|
215
220
|
const showPage = (id) => {
|
|
216
221
|
host.showPage(id);
|
|
217
222
|
setNavOpen(false);
|
|
@@ -391,7 +396,14 @@ function AppShell() {
|
|
|
391
396
|
showPage('');
|
|
392
397
|
}
|
|
393
398
|
};
|
|
394
|
-
const chats = (React.createElement(AssistantChatList, { sessions: workbench.sessions, saved: workbench.saved, removed: removedChats, archived: workbench.archived, onArchive: readArchived, foldDays: chatSettings.chatFoldDays, archiveDays: chatSettings.chatArchiveDays, selected: view || phone ? undefined : (pending !== null && pending !== void 0 ? pending : store === null || store === void 0 ? void 0 : store.sessionId), chat: chat, byDirectory: chatsByDirectory, onByDirectory: setChatsByDirectory, folded: foldedChats, onFolded: setFoldedChats, pinned: pinnedChats, onPinned: setPinnedChats, looking: looking, seen: seenChats,
|
|
399
|
+
const chats = (React.createElement(AssistantChatList, { sessions: workbench.sessions, saved: workbench.saved, removed: removedChats, archived: workbench.archived, onArchive: readArchived, foldDays: chatSettings.chatFoldDays, archiveDays: chatSettings.chatArchiveDays, selected: view || phone ? undefined : (pending !== null && pending !== void 0 ? pending : store === null || store === void 0 ? void 0 : store.sessionId), chat: chat, byDirectory: chatsByDirectory, onByDirectory: setChatsByDirectory, folded: foldedChats, onFolded: setFoldedChats, pinned: pinnedChats, onPinned: setPinnedChats, looking: looking, seen: seenChats, letGo: letGoAsks, onLetGo: entry => {
|
|
400
|
+
var _a;
|
|
401
|
+
const at = (_a = entry.asking) === null || _a === void 0 ? void 0 : _a.at;
|
|
402
|
+
if (at !== undefined) {
|
|
403
|
+
setLetGoAsks(before => ChatAskUtil.letGo(before, ChatListUtil.file(entry), at));
|
|
404
|
+
}
|
|
405
|
+
}, onPicked: picked }));
|
|
406
|
+
const sideList = sideView ? React.createElement(SidebarView, { view: sideView }) : sideComing ? React.createElement(ListSkeleton, null) : chats;
|
|
395
407
|
const editorArea = (React.createElement(EditorArea, { editors: extensions.editors, active: activeEditor, views: tools, onShow: id => host.showEditor(id), onClose: ids => void host.closeEditors(ids), onPin: id => host.pinEditor(id), onOpenView: openTool, onHide: editor.toggle, cwd: (_f = WebCwdUtil.shown(extensions)) !== null && _f !== void 0 ? _f : (_c = workbench.server) === null || _c === void 0 ? void 0 : _c.cwd, maximized: maximized, onMaximize: () => setMaximized(!maximized) }));
|
|
396
408
|
// A photo of the scan screen to the double: its conversation shows, the photo goes with what to do with it.
|
|
397
409
|
const askDouble = async (text, image) => {
|
|
@@ -472,10 +484,10 @@ function AppShell() {
|
|
|
472
484
|
}
|
|
473
485
|
: {};
|
|
474
486
|
// The chats' tab has the amber dot of their rows while one of them said something unseen, as a messenger's: of
|
|
475
|
-
// those the list shows, so that each dot of the tab has a row to find. Dragged away, all are seen.
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
487
|
+
// those the list shows, so that each dot of the tab has a row to find. Dragged away, all are seen. Those that
|
|
488
|
+
// wait for the user to decide are counted on it, on the rail too, until answered.
|
|
489
|
+
const listedChats = ChatListUtil.entries(workbench.sessions, workbench.saved, removedChats, undefined, WorkbenchUtil.daysAgo(Date.now(), chatSettings.chatArchiveDays), ChatListUtil.keptFiles(workbench.saved, pinnedChats, letGoAsks), ChatIconUtil.archiveSince(extensions.chatIcons, Date.now())).listed;
|
|
490
|
+
const chatsAsking = ChatAskUtil.count(listedChats, letGoAsks);
|
|
479
491
|
const inFront = looking ? workbench.sessions.find(session => session.sessionId === looking) : undefined;
|
|
480
492
|
const chatsUnseen = ChatSeenUtil.anyUnseen(listedChats, seenChats, inFront && ChatListUtil.file(inFront));
|
|
481
493
|
const seeAllChats = () => state.set(SEEN_CHATS, ChatSeenUtil.seeAll(state.get(SEEN_CHATS), listedChats, Date.now()));
|
|
@@ -486,7 +498,7 @@ function AppShell() {
|
|
|
486
498
|
fold: t('ta.nav.fold'),
|
|
487
499
|
settings: { label: t('ta.nav.settings'), run: () => openSettings('navigation') },
|
|
488
500
|
holds,
|
|
489
|
-
}).map(item => (item.id === '' && chatsUnseen ? { ...item, unseen:
|
|
501
|
+
}).map(item => (item.id === '' && (chatsUnseen || chatsAsking) ? { ...item, unseen: chatsUnseen, onSeeAll: seeAllChats, asks: chatsAsking } : item))
|
|
490
502
|
: [];
|
|
491
503
|
const tab = tabPage === 'me' ? ME_TAB : tabPage === 'discover' ? DISCOVER : ((_g = tabView === null || tabView === void 0 ? void 0 : tabView.id) !== null && _g !== void 0 ? _g : side);
|
|
492
504
|
// The launcher and the board are over the first tab only, as WeChat's over its chats.
|
|
@@ -507,7 +519,7 @@ function AppShell() {
|
|
|
507
519
|
}
|
|
508
520
|
}, home: tabPage === 'me' ? (React.createElement("div", { className: "ta-main" },
|
|
509
521
|
React.createElement(MeView, { onSettings: openSettings }))) : tabPage === 'discover' ? (React.createElement("div", { className: "ta-main" }, discoverView())) : tabView ? (React.createElement("div", { className: "ta-main" },
|
|
510
|
-
React.createElement(PageView, { view: tabView }))) : (React.createElement("div", { className: "ta-sidebar" },
|
|
522
|
+
React.createElement(PageView, { view: tabView }))) : (React.createElement("div", { className: "ta-sidebar" }, sideList)), screen: React.createElement(React.Fragment, null,
|
|
511
523
|
React.createElement(KeptPages, { views: extensions.views, kept: extensions.kept, shown: screenPage, render: page => (React.createElement(PageView, { view: page, leading: React.createElement(IconButton, { icon: ChevronLeft, label: t('ta.back'), className: "ta-narrow-only", onClick: closeScreen }) })) }),
|
|
512
524
|
settings !== undefined ? (React.createElement(SettingsView, { key: settingsOpened, section: settings || undefined, onClose: closeSettings, onBack: closeSettings })) : screenPage ? null : (React.createElement(ChatView, { widgets: extensions.widgets, onMenu: closeScreen, back: true }))), screenOpen: screenOpen, onBack: closeScreen, workbench: editors && !settingsShown ? (React.createElement("div", { className: "ta-editors-pane", inert: !showEditors }, editorArea)) : undefined, workbenchOpen: showEditors, onWorkbench: open => (open ? toggleWorkbench() : showEditors && toggleRight()) }, overlays)) : (React.createElement("div", { className: classes.filter(Boolean).join(' '), style: sideWidths },
|
|
513
525
|
navOpen && React.createElement("button", { type: "button", className: "ta-scrim", "aria-label": t('ta.close'), onClick: () => setNavOpen(false) }),
|
|
@@ -516,9 +528,9 @@ function AppShell() {
|
|
|
516
528
|
setSettings(undefined);
|
|
517
529
|
setNavOpen(false);
|
|
518
530
|
setTabPage('discover');
|
|
519
|
-
}, onSettings: openSettings, settingsShown: settings !== undefined, surfaces: surfaces, surface: surface, onSurface: setSurface, holds: holds }),
|
|
531
|
+
}, onSettings: openSettings, settingsShown: settings !== undefined, surfaces: surfaces, surface: surface, onSurface: setSurface, holds: holds, asks: chatsAsking }),
|
|
520
532
|
sideShown && (React.createElement("div", { className: "ta-sidebar", style: paneStyle(sidebar) },
|
|
521
|
-
|
|
533
|
+
sideList,
|
|
522
534
|
React.createElement(Sash, { pane: sidebar, side: "start", label: t('ta.layout.sidebar') })))),
|
|
523
535
|
React.createElement("main", { className: "ta-main" },
|
|
524
536
|
React.createElement(ConnectionBar, null),
|
|
@@ -537,7 +549,8 @@ function AppShell() {
|
|
|
537
549
|
React.createElement(SessionAvatars.Provider, { value: extensions.avatars },
|
|
538
550
|
React.createElement(ChatIconsProvider, { entries: extensions.chatIcons },
|
|
539
551
|
React.createElement(SessionMenus.Provider, { value: extensions.sessionMenus },
|
|
540
|
-
React.createElement(
|
|
552
|
+
React.createElement(LoadedExtensions.Provider, { value: extensions.extensions },
|
|
553
|
+
React.createElement(WorkbenchToggleContext.Provider, { value: toggle }, content)))))))))));
|
|
541
554
|
}
|
|
542
555
|
/** The app, with the look the user picked for the double (every ta below draws it) and the picker of that look. */
|
|
543
556
|
export function AppView() {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useT } from '../i18n/use-t.js';
|
|
3
|
+
/** How many conversations wait for the user to decide, on the entry of the chats (a tab, the rail): blue, as their ? on the rows. */
|
|
4
|
+
export function AsksBadge({ count }) {
|
|
5
|
+
const t = useT();
|
|
6
|
+
return (React.createElement("span", { className: "ta-asks-badge", role: "img", "aria-label": t('ta.chat.asksCount', { count }) }, count > 99 ? '99+' : count));
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=asks-badge.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { TaAsking, TaSavedSessionInfo, TaSessionInfo } from '@celljs/ta-protocol';
|
|
2
|
+
import type { WebAsk } from '../extension/web-api-contributions.js';
|
|
3
|
+
import type { StateSpec } from '../state/state-protocol.js';
|
|
4
|
+
/**
|
|
5
|
+
* The asks the user let go without answering (`Not now` of a row), by the file of their conversation: when the
|
|
6
|
+
* ask was (TaAsking.at). A later ask of the same conversation waits for them again.
|
|
7
|
+
*/
|
|
8
|
+
export type LetGoAsks = Record<string, number>;
|
|
9
|
+
/** The same on every device: one let go on the phone is let go on the computer too. */
|
|
10
|
+
export declare const LET_GO_ASKS: StateSpec<LetGoAsks>;
|
|
11
|
+
/** What a list reads of a conversation to know whether it waits for the user. */
|
|
12
|
+
export interface AskingEntry {
|
|
13
|
+
sessionFile?: string;
|
|
14
|
+
sessionId?: string;
|
|
15
|
+
asking?: TaAsking;
|
|
16
|
+
/** A dialog of an extension waits for an answer (TaSessionInfo.waiting): only an open session has one. */
|
|
17
|
+
waiting?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Which conversations wait for the user to decide: their last turn asked (TaSessionInfo.asking) and no message of
|
|
21
|
+
* theirs came since, or a dialog waits. Unlike a dot of something unseen, seeing it does not end it; answering does,
|
|
22
|
+
* typed or tapped, or letting it go.
|
|
23
|
+
*/
|
|
24
|
+
export declare namespace ChatAskUtil {
|
|
25
|
+
function parse(value: unknown): LetGoAsks | undefined;
|
|
26
|
+
/** Each let go as late as either page let it go; `a` itself when `b` adds nothing. */
|
|
27
|
+
function merge(a: LetGoAsks, b: LetGoAsks): LetGoAsks;
|
|
28
|
+
/** Lets the ask of the conversation go, as it was asked at `at`. */
|
|
29
|
+
function letGo(before: LetGoAsks, file: string, at: number): LetGoAsks;
|
|
30
|
+
/** What it still asks the user: none once answered or let go. */
|
|
31
|
+
function asking(entry: AskingEntry, letGo: LetGoAsks): TaAsking | undefined;
|
|
32
|
+
/** Whether it waits for the user: it asks, or a dialog of it waits. */
|
|
33
|
+
function waits(entry: AskingEntry, letGo: LetGoAsks): boolean;
|
|
34
|
+
/** How many of the conversations the list shows wait for the user: the count on the tab of the chats. */
|
|
35
|
+
function count(entries: readonly AskingEntry[], letGo: LetGoAsks): number;
|
|
36
|
+
/**
|
|
37
|
+
* The conversations that wait for the user, for extensions (ui.useAsks): the open ones and those saved, but those a
|
|
38
|
+
* package opened for a role of its own and closed (the list leaves them out), the latest ask first.
|
|
39
|
+
*/
|
|
40
|
+
function list(sessions: readonly TaSessionInfo[], saved: readonly TaSavedSessionInfo[], letGo: LetGoAsks): WebAsk[];
|
|
41
|
+
/** Those that wait for the user, a dialog first, then the latest ask first; and the rest, in the order they had. */
|
|
42
|
+
function apart<T extends AskingEntry>(entries: readonly T[], letGo: LetGoAsks): {
|
|
43
|
+
asking: T[];
|
|
44
|
+
rest: T[];
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/** The asks let go remembered at most: past that, the oldest are forgotten, which are long answered. */
|
|
2
|
+
const KEPT = 100;
|
|
3
|
+
/** The same on every device: one let go on the phone is let go on the computer too. */
|
|
4
|
+
export const LET_GO_ASKS = {
|
|
5
|
+
key: 'chat.letGoAsks',
|
|
6
|
+
tier: 'user',
|
|
7
|
+
initial: {},
|
|
8
|
+
parse: value => ChatAskUtil.parse(value),
|
|
9
|
+
merge: (local, remote) => ChatAskUtil.merge(local, remote),
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Which conversations wait for the user to decide: their last turn asked (TaSessionInfo.asking) and no message of
|
|
13
|
+
* theirs came since, or a dialog waits. Unlike a dot of something unseen, seeing it does not end it; answering does,
|
|
14
|
+
* typed or tapped, or letting it go.
|
|
15
|
+
*/
|
|
16
|
+
export var ChatAskUtil;
|
|
17
|
+
(function (ChatAskUtil) {
|
|
18
|
+
function parse(value) {
|
|
19
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
return Object.fromEntries(Object.entries(value).filter(([, at]) => typeof at === 'number'));
|
|
23
|
+
}
|
|
24
|
+
ChatAskUtil.parse = parse;
|
|
25
|
+
/** Each let go as late as either page let it go; `a` itself when `b` adds nothing. */
|
|
26
|
+
function merge(a, b) {
|
|
27
|
+
const later = Object.entries(b).filter(([file, at]) => { var _a; return at > ((_a = a[file]) !== null && _a !== void 0 ? _a : 0); });
|
|
28
|
+
return later.length ? keep({ ...a, ...Object.fromEntries(later) }) : a;
|
|
29
|
+
}
|
|
30
|
+
ChatAskUtil.merge = merge;
|
|
31
|
+
/** Lets the ask of the conversation go, as it was asked at `at`. */
|
|
32
|
+
function letGo(before, file, at) {
|
|
33
|
+
var _a;
|
|
34
|
+
return ((_a = before[file]) !== null && _a !== void 0 ? _a : 0) >= at ? before : keep({ ...before, [file]: at });
|
|
35
|
+
}
|
|
36
|
+
ChatAskUtil.letGo = letGo;
|
|
37
|
+
function keep(letGo) {
|
|
38
|
+
const files = Object.keys(letGo);
|
|
39
|
+
if (files.length <= KEPT) {
|
|
40
|
+
return letGo;
|
|
41
|
+
}
|
|
42
|
+
const kept = files.sort((x, y) => letGo[y] - letGo[x]).slice(0, KEPT);
|
|
43
|
+
return Object.fromEntries(kept.map(file => [file, letGo[file]]));
|
|
44
|
+
}
|
|
45
|
+
function fileOf(entry) {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
return (_b = (_a = entry.sessionFile) !== null && _a !== void 0 ? _a : entry.sessionId) !== null && _b !== void 0 ? _b : '';
|
|
48
|
+
}
|
|
49
|
+
/** What it still asks the user: none once answered or let go. */
|
|
50
|
+
function asking(entry, letGo) {
|
|
51
|
+
var _a;
|
|
52
|
+
const { asking } = entry;
|
|
53
|
+
return asking && asking.at > ((_a = letGo[fileOf(entry)]) !== null && _a !== void 0 ? _a : -1) ? asking : undefined;
|
|
54
|
+
}
|
|
55
|
+
ChatAskUtil.asking = asking;
|
|
56
|
+
/** Whether it waits for the user: it asks, or a dialog of it waits. */
|
|
57
|
+
function waits(entry, letGo) {
|
|
58
|
+
return !!entry.waiting || !!asking(entry, letGo);
|
|
59
|
+
}
|
|
60
|
+
ChatAskUtil.waits = waits;
|
|
61
|
+
/** How many of the conversations the list shows wait for the user: the count on the tab of the chats. */
|
|
62
|
+
function count(entries, letGo) {
|
|
63
|
+
return entries.filter(entry => waits(entry, letGo)).length;
|
|
64
|
+
}
|
|
65
|
+
ChatAskUtil.count = count;
|
|
66
|
+
/**
|
|
67
|
+
* The conversations that wait for the user, for extensions (ui.useAsks): the open ones and those saved, but those a
|
|
68
|
+
* package opened for a role of its own and closed (the list leaves them out), the latest ask first.
|
|
69
|
+
*/
|
|
70
|
+
function list(sessions, saved, letGo) {
|
|
71
|
+
const open = new Set(sessions.map(session => session.sessionFile));
|
|
72
|
+
const closed = saved.filter(session => !session.group && !open.has(session.sessionFile));
|
|
73
|
+
return apart([...sessions, ...closed], letGo).asking.map(entry => {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
var _c;
|
|
76
|
+
const question = (_a = asking(entry, letGo)) === null || _a === void 0 ? void 0 : _a.question;
|
|
77
|
+
return {
|
|
78
|
+
sessionFile: fileOf(entry),
|
|
79
|
+
sessionId: 'sessionId' in entry ? entry.sessionId : undefined,
|
|
80
|
+
cwd: entry.cwd,
|
|
81
|
+
title: entry.sessionName || entry.firstMessage || '',
|
|
82
|
+
...(question && !entry.waiting ? { question } : {}),
|
|
83
|
+
at: (_c = (_b = entry.asking) === null || _b === void 0 ? void 0 : _b.at) !== null && _c !== void 0 ? _c : entry.updatedAt,
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
ChatAskUtil.list = list;
|
|
88
|
+
/** Those that wait for the user, a dialog first, then the latest ask first; and the rest, in the order they had. */
|
|
89
|
+
function apart(entries, letGo) {
|
|
90
|
+
const asking = [];
|
|
91
|
+
const rest = [];
|
|
92
|
+
for (const entry of entries) {
|
|
93
|
+
(waits(entry, letGo) ? asking : rest).push(entry);
|
|
94
|
+
}
|
|
95
|
+
const rank = (entry) => { var _a; var _b; return (entry.waiting ? Number.POSITIVE_INFINITY : ((_b = (_a = entry.asking) === null || _a === void 0 ? void 0 : _a.at) !== null && _b !== void 0 ? _b : 0)); };
|
|
96
|
+
asking.sort((x, y) => rank(y) - rank(x));
|
|
97
|
+
return { asking, rest };
|
|
98
|
+
}
|
|
99
|
+
ChatAskUtil.apart = apart;
|
|
100
|
+
})(ChatAskUtil || (ChatAskUtil = {}));
|
|
101
|
+
//# sourceMappingURL=chat-asks.js.map
|
|
@@ -5,6 +5,7 @@ import type { TaChat } from '../chat/chat-protocol.js';
|
|
|
5
5
|
import type { MessageId } from '../i18n/messages.js';
|
|
6
6
|
import { type Translate } from '../i18n/use-t.js';
|
|
7
7
|
import { type StateSpec } from '../state/state-protocol.js';
|
|
8
|
+
import { type LetGoAsks } from './chat-asks.js';
|
|
8
9
|
import { type ChatSeen } from './chat-seen.js';
|
|
9
10
|
/** Where a conversation belongs: the directory of the user's own, or the package that opened it. */
|
|
10
11
|
export interface ChatSource {
|
|
@@ -61,6 +62,8 @@ export declare namespace ChatListUtil {
|
|
|
61
62
|
function key(entry: ChatEntry): string;
|
|
62
63
|
/** What stays the same as it closes and opens again: its file, else (before it has one) the id of its session. */
|
|
63
64
|
function file(entry: ChatEntry): string;
|
|
65
|
+
/** The files the list keeps however old (ChatListUtil.entries): those pinned, and the saved ones that still ask the user. */
|
|
66
|
+
function keptFiles(saved: readonly TaSavedSessionInfo[], pinned: readonly string[], letGo: LetGoAsks): readonly string[];
|
|
64
67
|
/** Those pinned, and the rest, each in the order it had. */
|
|
65
68
|
function pinnedApart(sessions: ChatEntry[], pinned: readonly string[]): {
|
|
66
69
|
pinned: ChatEntry[];
|
|
@@ -173,6 +176,9 @@ export interface ChatListProps {
|
|
|
173
176
|
looking?: string;
|
|
174
177
|
/** When the user last saw each conversation (useSeenChats): those that said something since have a dot. */
|
|
175
178
|
seen: ChatSeen;
|
|
179
|
+
/** The asks the user let go (LET_GO_ASKS): the others wait for them at the top of the list. */
|
|
180
|
+
letGo: LetGoAsks;
|
|
181
|
+
onLetGo(entry: ChatEntry): void;
|
|
176
182
|
/** As a chat is picked, not once it is shown (it shows at once, while it opens): a drawer closes, a phone slides it in. */
|
|
177
183
|
onPicked(): void;
|
|
178
184
|
/** Under the head: the state of the connection on a phone (ConnectionBanner). */
|
|
@@ -185,4 +191,4 @@ export interface ChatListProps {
|
|
|
185
191
|
* opened or searched, and those taken out last, folded, to put back. However long, it draws the rows of
|
|
186
192
|
* its first screens, and more as it is scrolled to its end.
|
|
187
193
|
*/
|
|
188
|
-
export declare function ChatList({ sessions, saved, removed: removedFiles, archived: archivedSaved, onArchive, foldDays, archiveDays, selected, chat, byDirectory, onByDirectory, folded, onFolded, onPicked, double, notice, pinned, onPinned, looking, seen, }: ChatListProps): React.JSX.Element;
|
|
194
|
+
export declare function ChatList({ sessions, saved, removed: removedFiles, archived: archivedSaved, onArchive, foldDays, archiveDays, selected, chat, byDirectory, onByDirectory, folded, onFolded, onPicked, double, notice, pinned, onPinned, looking, seen, letGo, onLetGo, }: ChatListProps): React.JSX.Element;
|
|
@@ -8,6 +8,7 @@ import { StateUtil } from '../state/state-protocol.js';
|
|
|
8
8
|
import { MessageUtil } from '../util/message.js';
|
|
9
9
|
import { WorkbenchUtil } from '../workbench-util.js';
|
|
10
10
|
import { useBusy } from './busy.js';
|
|
11
|
+
import { ChatAskUtil } from './chat-asks.js';
|
|
11
12
|
import { ChatIconTile, ChatIconUtil, useChatIcon } from './chat-icon.js';
|
|
12
13
|
import { ChatSeenUtil } from './chat-seen.js';
|
|
13
14
|
import { useContextMenu } from './context-menu.js';
|
|
@@ -62,6 +63,12 @@ export var ChatListUtil;
|
|
|
62
63
|
return (_a = entry.sessionFile) !== null && _a !== void 0 ? _a : entry.sessionId;
|
|
63
64
|
}
|
|
64
65
|
ChatListUtil.file = file;
|
|
66
|
+
/** The files the list keeps however old (ChatListUtil.entries): those pinned, and the saved ones that still ask the user. */
|
|
67
|
+
function keptFiles(saved, pinned, letGo) {
|
|
68
|
+
const asking = saved.filter(session => ChatAskUtil.asking(session, letGo)).map(session => session.sessionFile);
|
|
69
|
+
return asking.length ? [...pinned, ...asking] : pinned;
|
|
70
|
+
}
|
|
71
|
+
ChatListUtil.keptFiles = keptFiles;
|
|
65
72
|
/** Those pinned, and the rest, each in the order it had. */
|
|
66
73
|
function pinnedApart(sessions, pinned) {
|
|
67
74
|
const files = new Set(pinned);
|
|
@@ -335,12 +342,19 @@ function ChatState({ streaming, waiting, task }) {
|
|
|
335
342
|
}
|
|
336
343
|
return null;
|
|
337
344
|
}
|
|
338
|
-
/**
|
|
339
|
-
|
|
345
|
+
/**
|
|
346
|
+
* Always there, so that it grows in and goes, the avatar never drawn again; told only while it is on. A conversation
|
|
347
|
+
* that waits for the user to decide has a blue ? instead, over an amber dot: seeing it does not end it, answering does.
|
|
348
|
+
*/
|
|
349
|
+
function ChatDot({ unseen, asks }) {
|
|
340
350
|
const t = useT();
|
|
341
|
-
|
|
351
|
+
if (asks) {
|
|
352
|
+
return (React.createElement("span", { className: "ta-chat-dot ta-on ta-asks", role: "img", "aria-label": t('ta.chat.asking') }, "?"));
|
|
353
|
+
}
|
|
354
|
+
return unseen ? React.createElement("span", { className: "ta-chat-dot ta-on", role: "img", "aria-label": t('ta.chat.unseen') }) : React.createElement("span", { className: "ta-chat-dot" });
|
|
342
355
|
}
|
|
343
|
-
const ChatItem = React.memo(function ChatItem({ session, source, selected, time, compact, actions, restorable, task, doubleName, handable, pinned, unseen, }) {
|
|
356
|
+
const ChatItem = React.memo(function ChatItem({ session, source, selected, time, compact, actions, restorable, task, doubleName, handable, pinned, unseen, asking, }) {
|
|
357
|
+
var _a;
|
|
344
358
|
const t = useT();
|
|
345
359
|
const onSelect = () => actions.open(session);
|
|
346
360
|
const [removing, run] = useBusy();
|
|
@@ -356,6 +370,7 @@ const ChatItem = React.memo(function ChatItem({ session, source, selected, time,
|
|
|
356
370
|
const [menu, openMenu] = useContextMenu();
|
|
357
371
|
const onContextMenu = (event) => openMenu(event, [
|
|
358
372
|
{ label: t('ta.chat.open'), run: onSelect },
|
|
373
|
+
...(asking ? [{ label: t('ta.chat.letGo'), run: () => actions.letGo(session) }] : []),
|
|
359
374
|
...(onPin ? [{ label: t(pinned ? 'ta.chat.unpin' : 'ta.chat.pin'), run: onPin }] : []),
|
|
360
375
|
...(onHand ? [{ label: t('ta.chat.handToDouble'), run: onHand }] : []),
|
|
361
376
|
// What extensions add (Share…) before taking it out, which stays last.
|
|
@@ -375,24 +390,25 @@ const ChatItem = React.memo(function ChatItem({ session, source, selected, time,
|
|
|
375
390
|
// A dialog of it waits for the user: it needs them, it does not answer meanwhile.
|
|
376
391
|
const waiting = ChatListUtil.isOpen(session) && !!session.waiting;
|
|
377
392
|
const streaming = ChatListUtil.isOpen(session) && session.isStreaming && !waiting;
|
|
378
|
-
const
|
|
393
|
+
const asks = waiting || (!!asking && !streaming);
|
|
394
|
+
const mood = asks ? 'attention' : streaming ? 'working' : 'idle';
|
|
379
395
|
const state = React.createElement(ChatState, { streaming: streaming, waiting: waiting, task: task });
|
|
380
396
|
// As in a messaging app, the last thing said; its directory before the first, and on hover in place of its time.
|
|
381
397
|
const said = ChatListUtil.preview(session, title);
|
|
382
398
|
const place = who ? MessageUtil.basename(session.cwd) : source.label;
|
|
383
399
|
const ended = task === 'failed' || task === 'stopped' ? task : undefined;
|
|
384
|
-
return (React.createElement(SwipeRow, { as: "li", className: `ta-chat-row${selected ? ' ta-selected' : ''}${who ? ` ta-chat-${who.kind}` : ''}`, "data-unseen": unseen ? '' : undefined, actions: swipe, overlay: menu, onContextMenu: onContextMenu },
|
|
400
|
+
return (React.createElement(SwipeRow, { as: "li", className: `ta-chat-row${selected ? ' ta-selected' : ''}${who ? ` ta-chat-${who.kind}` : ''}`, "data-unseen": unseen && !asks ? '' : undefined, "data-asks": asks ? '' : undefined, actions: swipe, overlay: menu, onContextMenu: onContextMenu },
|
|
385
401
|
React.createElement("button", { type: "button", className: `ta-chat-item${compact ? ' ta-compact' : ''}${removing ? ' ta-pending' : ''}`, title: `${title}\n${source.title}`, "aria-current": selected ? 'true' : undefined, onClick: onSelect }, compact ? (React.createElement("span", { className: "ta-chat-text" },
|
|
386
402
|
React.createElement("span", { className: "ta-chat-line" },
|
|
387
403
|
who && React.createElement(ChatAvatar, { session: session, source: source, who: who, size: 20, mood: mood }),
|
|
388
404
|
tag,
|
|
389
405
|
React.createElement("span", { className: "ta-chat-title" }, title),
|
|
390
406
|
state,
|
|
391
|
-
React.createElement(
|
|
407
|
+
React.createElement(ChatDot, { unseen: !!unseen, asks: asks }),
|
|
392
408
|
React.createElement("span", { className: "ta-chat-time" }, removing && handheld ? React.createElement("span", { className: "ta-spinner ta-later" }) : time)))) : (React.createElement(React.Fragment, null,
|
|
393
409
|
React.createElement("span", { className: "ta-chat-avatar-box" },
|
|
394
410
|
React.createElement(ChatAvatar, { session: session, source: source, who: who, size: 38, mood: mood }),
|
|
395
|
-
React.createElement(
|
|
411
|
+
React.createElement(ChatDot, { unseen: !!unseen, asks: asks })),
|
|
396
412
|
React.createElement("span", { className: "ta-chat-text" },
|
|
397
413
|
React.createElement("span", { className: "ta-chat-line" },
|
|
398
414
|
tag,
|
|
@@ -408,10 +424,14 @@ const ChatItem = React.memo(function ChatItem({ session, source, selected, time,
|
|
|
408
424
|
"[",
|
|
409
425
|
t('ta.task.waiting'),
|
|
410
426
|
"]"),
|
|
411
|
-
|
|
427
|
+
asks && !waiting && React.createElement("span", { className: "ta-chat-flag ta-waiting" },
|
|
428
|
+
"[",
|
|
429
|
+
t('ta.chat.asking'),
|
|
430
|
+
"]"),
|
|
431
|
+
ended && !streaming && !asks && (React.createElement("span", { className: `ta-chat-flag ta-${ended}` },
|
|
412
432
|
"[",
|
|
413
433
|
t(ended === 'failed' ? 'ta.task.failed' : 'ta.task.stopped'),
|
|
414
|
-
"]")), said !== null &&
|
|
434
|
+
"]")), (_a = (asks && !waiting ? asking : said)) !== null && _a !== void 0 ? _a : (React.createElement("span", { className: "ta-chat-dir" },
|
|
415
435
|
React.createElement(Icon, { icon: Folder, size: 12 }),
|
|
416
436
|
place))),
|
|
417
437
|
streaming && React.createElement("span", { className: "ta-chat-state ta-spinner" })))))),
|
|
@@ -424,7 +444,7 @@ const ChatItem = React.memo(function ChatItem({ session, source, selected, time,
|
|
|
424
444
|
* opened or searched, and those taken out last, folded, to put back. However long, it draws the rows of
|
|
425
445
|
* its first screens, and more as it is scrolled to its end.
|
|
426
446
|
*/
|
|
427
|
-
export function ChatList({ sessions, saved, removed: removedFiles, archived: archivedSaved, onArchive, foldDays, archiveDays, selected, chat, byDirectory, onByDirectory, folded, onFolded, onPicked, double, notice, pinned, onPinned, looking, seen, }) {
|
|
447
|
+
export function ChatList({ sessions, saved, removed: removedFiles, archived: archivedSaved, onArchive, foldDays, archiveDays, selected, chat, byDirectory, onByDirectory, folded, onFolded, onPicked, double, notice, pinned, onPinned, looking, seen, letGo, onLetGo, }) {
|
|
428
448
|
const t = useT();
|
|
429
449
|
const now = useMinute();
|
|
430
450
|
const [query, setQuery] = React.useState('');
|
|
@@ -438,8 +458,8 @@ export function ChatList({ sessions, saved, removed: removedFiles, archived: arc
|
|
|
438
458
|
const pageCount = typeof IntersectionObserver === 'undefined' ? Number.POSITIVE_INFINITY : paged.query === query ? paged.count : CHAT_PAGE;
|
|
439
459
|
// What the rows do reads the props of now, through one object that stays the same: no row is drawn again for it.
|
|
440
460
|
const sessionMenus = React.useContext(SessionMenus);
|
|
441
|
-
const latest = React.useRef({ chat, double, onPicked, t, pinned, onPinned, sessionMenus });
|
|
442
|
-
latest.current = { chat, double, onPicked, t, pinned, onPinned, sessionMenus };
|
|
461
|
+
const latest = React.useRef({ chat, double, onPicked, t, pinned, onPinned, sessionMenus, onLetGo });
|
|
462
|
+
latest.current = { chat, double, onPicked, t, pinned, onPinned, sessionMenus, onLetGo };
|
|
443
463
|
const actions = React.useMemo(() => {
|
|
444
464
|
const pick = (change) => {
|
|
445
465
|
void change;
|
|
@@ -461,6 +481,7 @@ export function ChatList({ sessions, saved, removed: removedFiles, archived: arc
|
|
|
461
481
|
const others = latest.current.pinned.filter(other => other !== file);
|
|
462
482
|
latest.current.onPinned(pin ? [file, ...others] : others);
|
|
463
483
|
},
|
|
484
|
+
letGo: entry => latest.current.onLetGo(entry),
|
|
464
485
|
extensionMenu: (entry, title) => {
|
|
465
486
|
const open = ChatListUtil.isOpen(entry);
|
|
466
487
|
const session = {
|
|
@@ -488,13 +509,16 @@ export function ChatList({ sessions, saved, removed: removedFiles, archived: arc
|
|
|
488
509
|
const icons = React.useContext(ChatIcons);
|
|
489
510
|
// biome-ignore lint/correctness/useExhaustiveDependencies: its bounds move with the day, as `since` does
|
|
490
511
|
const sooner = React.useMemo(() => ChatIconUtil.archiveSince(icons.entries, now), [icons, since]);
|
|
491
|
-
|
|
512
|
+
// One that waits for the user is not archived, however old, as one pinned.
|
|
513
|
+
const kept = React.useMemo(() => ChatListUtil.keptFiles([...saved, ...(archivedSaved !== null && archivedSaved !== void 0 ? archivedSaved : [])], pinned, letGo), [saved, archivedSaved, pinned, letGo]);
|
|
514
|
+
const { listed, archived, removed } = React.useMemo(() => ChatListUtil.entries(sessions, saved, removedFiles, archivedSaved, since, kept, sooner), [sessions, saved, removedFiles, archivedSaved, since, kept, sooner]);
|
|
492
515
|
const sources = React.useMemo(() => ChatListUtil.sources(listed), [listed]);
|
|
493
516
|
// A search finds the archived too.
|
|
494
517
|
const shown = React.useMemo(() => ChatListUtil.filter(searching ? [...listed, ...archived] : listed, query, t), [listed, archived, searching, query, t]);
|
|
495
518
|
const shownRemoved = React.useMemo(() => ChatListUtil.filter(removed, query, t), [removed, query, t]);
|
|
496
|
-
// Those
|
|
497
|
-
const
|
|
519
|
+
// Those that wait for the user to decide are at the very top, then those pinned, whatever their day or directory.
|
|
520
|
+
const asks = React.useMemo(() => (searching ? { asking: [], rest: shown } : ChatAskUtil.apart(shown, letGo)), [shown, letGo, searching]);
|
|
521
|
+
const apart = React.useMemo(() => ChatListUtil.pinnedApart(asks.rest, pinned), [asks.rest, pinned]);
|
|
498
522
|
const lookedAt = looking ? sessions.find(session => session.sessionId === looking) : undefined;
|
|
499
523
|
const inFront = lookedAt && ChatListUtil.file(lookedAt);
|
|
500
524
|
// What a search finds is one list by day, wherever it is.
|
|
@@ -522,7 +546,7 @@ export function ChatList({ sessions, saved, removed: removedFiles, archived: arc
|
|
|
522
546
|
const stays = (session) => isSelected(session) || isUnseen(session);
|
|
523
547
|
const budget = ChatListUtil.budget(pageCount, stays);
|
|
524
548
|
const pinnedFiles = React.useMemo(() => new Set(pinned), [pinned]);
|
|
525
|
-
const item = (session, compact) => (React.createElement(ChatItem, { key: ChatListUtil.key(session), session: session, source: byKey.get(ChatListUtil.sourceKey(session)), selected: ChatListUtil.key(session) === selected, time: ChatListUtil.clock(session.updatedAt, now), compact: compact, actions: actions, task: ChatListUtil.isOpen(session) ? double === null || double === void 0 ? void 0 : double.tasks.get(session.sessionId) : undefined, doubleName: double && ChatListUtil.isDouble(session, double) ? double.name : undefined, handable: !!double && ChatListUtil.isOpen(session) && !session.group && !double.tasks.has(session.sessionId) && !ChatListUtil.isDouble(session, double), pinned: pinnedFiles.has(ChatListUtil.file(session)), unseen: isUnseen(session) }));
|
|
549
|
+
const item = (session, compact) => { var _a; return (React.createElement(ChatItem, { key: ChatListUtil.key(session), session: session, source: byKey.get(ChatListUtil.sourceKey(session)), selected: ChatListUtil.key(session) === selected, time: ChatListUtil.clock(session.updatedAt, now), compact: compact, actions: actions, task: ChatListUtil.isOpen(session) ? double === null || double === void 0 ? void 0 : double.tasks.get(session.sessionId) : undefined, doubleName: double && ChatListUtil.isDouble(session, double) ? double.name : undefined, handable: !!double && ChatListUtil.isOpen(session) && !session.group && !double.tasks.has(session.sessionId) && !ChatListUtil.isDouble(session, double), pinned: pinnedFiles.has(ChatListUtil.file(session)), unseen: isUnseen(session), asking: (_a = ChatAskUtil.asking(session, letGo)) === null || _a === void 0 ? void 0 : _a.question })); };
|
|
526
550
|
// The conversation shown is found in the list, however it came to be shown: out of a search that hides it, and scrolled to.
|
|
527
551
|
const scroller = React.useRef(null);
|
|
528
552
|
const end = React.useRef(null);
|
|
@@ -631,6 +655,11 @@ export function ChatList({ sessions, saved, removed: removedFiles, archived: arc
|
|
|
631
655
|
React.createElement(IconButton, { className: "ta-chats-add", icon: Plus, label: t('ta.chat.new'), onClick: () => pick(chat.draft()) })),
|
|
632
656
|
notice,
|
|
633
657
|
React.createElement("div", { className: "ta-side-scroll", ref: scroller },
|
|
658
|
+
asks.asking.length > 0 && (React.createElement("section", { className: "ta-chat-section ta-chat-asks" },
|
|
659
|
+
React.createElement("div", { className: "ta-chat-section-title" },
|
|
660
|
+
t('ta.chat.asks'),
|
|
661
|
+
React.createElement("span", { className: "ta-chat-asks-count" }, asks.asking.length)),
|
|
662
|
+
React.createElement("ul", { className: "ta-side-list" }, asks.asking.map(session => item(session))))),
|
|
634
663
|
apart.pinned.length > 0 && (React.createElement("section", { className: "ta-chat-section ta-chat-pinned" },
|
|
635
664
|
React.createElement("div", { className: "ta-chat-section-title" }, t('ta.chat.pinned')),
|
|
636
665
|
React.createElement("ul", { className: "ta-side-list" }, apart.pinned.map(session => item(session))))),
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { WebComposerAction, WebConversation } from '../extension/web-extension-api.js';
|
|
3
|
+
import type { WebComposerAddonEntry } from '../extension/web-extension-protocol.js';
|
|
4
|
+
import type { ComposerAction } from './composer-box.js';
|
|
5
|
+
export declare namespace ComposerAddonUtil {
|
|
6
|
+
function action(entry: WebComposerAction): ComposerAction;
|
|
7
|
+
/** An icon given as a component (`ui.icons.Eye`), which React cannot draw as a child, is drawn at 16 pixels. */
|
|
8
|
+
function icon(given: WebComposerAction['icon']): React.ReactNode;
|
|
9
|
+
/** The entries of each addon, a section each; an addon that fails adds none. */
|
|
10
|
+
function actions(addons: readonly WebComposerAddonEntry[], conversation: WebConversation | undefined): ComposerAction[][];
|
|
11
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export var ComposerAddonUtil;
|
|
3
|
+
(function (ComposerAddonUtil) {
|
|
4
|
+
function action(entry) {
|
|
5
|
+
const { items, icon: given, ...rest } = entry;
|
|
6
|
+
const drawn = { ...rest, icon: icon(given) };
|
|
7
|
+
return items ? { ...drawn, items: items.map(action) } : drawn;
|
|
8
|
+
}
|
|
9
|
+
ComposerAddonUtil.action = action;
|
|
10
|
+
/** An icon given as a component (`ui.icons.Eye`), which React cannot draw as a child, is drawn at 16 pixels. */
|
|
11
|
+
function icon(given) {
|
|
12
|
+
const component = typeof given === 'function' || (typeof given === 'object' && given !== null && '$$typeof' in given && !React.isValidElement(given));
|
|
13
|
+
if (component) {
|
|
14
|
+
const Icon = given;
|
|
15
|
+
return React.createElement(Icon, { size: 16 });
|
|
16
|
+
}
|
|
17
|
+
return given;
|
|
18
|
+
}
|
|
19
|
+
ComposerAddonUtil.icon = icon;
|
|
20
|
+
/** The entries of each addon, a section each; an addon that fails adds none. */
|
|
21
|
+
function actions(addons, conversation) {
|
|
22
|
+
if (!conversation) {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
return addons.flatMap(({ id, addon }) => {
|
|
26
|
+
var _a;
|
|
27
|
+
var _b;
|
|
28
|
+
try {
|
|
29
|
+
const entries = (_b = (_a = addon.actions) === null || _a === void 0 ? void 0 : _a.call(addon, conversation)) !== null && _b !== void 0 ? _b : [];
|
|
30
|
+
return entries.length > 0 ? [entries.map(action)] : [];
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
console.error(`The composer addon ${id} failed:`, error);
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
ComposerAddonUtil.actions = actions;
|
|
39
|
+
})(ComposerAddonUtil || (ComposerAddonUtil = {}));
|
|
40
|
+
//# sourceMappingURL=composer-addon-util.js.map
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
import type { WebComposerAddonEntry } from '../extension/web-extension-protocol.js';
|
|
2
|
+
import type { WebConversation } from '../extension/web-extension-api.js';
|
|
4
3
|
import type { ComposerAction } from './composer-box.js';
|
|
5
|
-
export declare namespace ComposerAddonUtil {
|
|
6
|
-
function action(entry: WebComposerAction): ComposerAction;
|
|
7
|
-
/** The entries of each addon, a section each; an addon that fails adds none. */
|
|
8
|
-
function actions(addons: readonly WebComposerAddonEntry[], conversation: WebConversation | undefined): ComposerAction[][];
|
|
9
|
-
}
|
|
10
4
|
/**
|
|
11
5
|
* What web extensions add to the message box of a conversation (registerComposerAddon): sections of its +
|
|
12
6
|
* menu, and what each draws above the box, in its own boundary.
|
|
@@ -1,33 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ExtensionBoundary } from '../extension/extension-view.js';
|
|
3
3
|
import { useWebExtensions } from '../hooks.js';
|
|
4
|
-
|
|
5
|
-
(function (ComposerAddonUtil) {
|
|
6
|
-
function action(entry) {
|
|
7
|
-
const { items, ...rest } = entry;
|
|
8
|
-
return items ? { ...rest, items: items.map(action) } : rest;
|
|
9
|
-
}
|
|
10
|
-
ComposerAddonUtil.action = action;
|
|
11
|
-
/** The entries of each addon, a section each; an addon that fails adds none. */
|
|
12
|
-
function actions(addons, conversation) {
|
|
13
|
-
if (!conversation) {
|
|
14
|
-
return [];
|
|
15
|
-
}
|
|
16
|
-
return addons.flatMap(({ id, addon }) => {
|
|
17
|
-
var _a;
|
|
18
|
-
var _b;
|
|
19
|
-
try {
|
|
20
|
-
const entries = (_b = (_a = addon.actions) === null || _a === void 0 ? void 0 : _a.call(addon, conversation)) !== null && _b !== void 0 ? _b : [];
|
|
21
|
-
return entries.length > 0 ? [entries.map(action)] : [];
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
console.error(`The composer addon ${id} failed:`, error);
|
|
25
|
-
return [];
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
ComposerAddonUtil.actions = actions;
|
|
30
|
-
})(ComposerAddonUtil || (ComposerAddonUtil = {}));
|
|
4
|
+
import { ComposerAddonUtil } from './composer-addon-util.js';
|
|
31
5
|
/**
|
|
32
6
|
* What web extensions add to the message box of a conversation (registerComposerAddon): sections of its +
|
|
33
7
|
* menu, and what each draws above the box, in its own boundary.
|
|
@@ -45,6 +45,7 @@ export interface ComposerBoxProps {
|
|
|
45
45
|
placeholder: string;
|
|
46
46
|
/** Something runs: with nothing typed, the button stops it. */
|
|
47
47
|
working?: boolean;
|
|
48
|
+
/** Stops it; the button spins from the press until `working` is false, or a promise it returns fails. */
|
|
48
49
|
onStop?(): void;
|
|
49
50
|
/** Sends; when it fails, what was sent comes back into the box. `followUp`: Alt+Enter. */
|
|
50
51
|
onSend(message: string, images: ComposerImage[], followUp: boolean): Promise<unknown>;
|