@celljs/ta-web 4.12.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 +5 -4
- package/esm/browser/assistant/assistant.d.ts +5 -0
- package/esm/browser/assistant/assistant.js +25 -6
- 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 +18 -9
- 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.d.ts +7 -1
- package/esm/browser/components/composer.js +33 -20
- package/esm/browser/components/connection-bar.js +31 -12
- package/esm/browser/components/conversation-scroll-util.d.ts +5 -0
- package/esm/browser/components/conversation-scroll-util.js +18 -0
- package/esm/browser/components/conversation-scroll.d.ts +12 -2
- package/esm/browser/components/conversation-scroll.js +68 -5
- 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/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 +4 -39
- package/esm/browser/components/mermaid-view.js +45 -3
- package/esm/browser/components/message-footer.d.ts +2 -0
- package/esm/browser/components/message-footer.js +8 -1
- package/esm/browser/components/message-list.d.ts +12 -0
- package/esm/browser/components/message-list.js +156 -25
- package/esm/browser/components/phone-shell.d.ts +7 -2
- package/esm/browser/components/phone-shell.js +7 -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.js +16 -4
- package/esm/browser/components/settings-controls.js +3 -3
- package/esm/browser/components/settings-parts.js +13 -1
- 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/web-composer.js +2 -1
- 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 +9 -1
- package/esm/browser/extension/web-api-components.d.ts +3 -3
- package/esm/browser/extension/web-api-contributions.d.ts +119 -0
- package/esm/browser/extension/web-extension-api.d.ts +23 -46
- package/esm/browser/extension/web-extension-context.d.ts +6 -1
- package/esm/browser/extension/web-extension-context.js +63 -6
- package/esm/browser/extension/web-extension-protocol.d.ts +5 -1
- package/esm/browser/extension/web-extension-protocol.js +1 -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 +9 -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 +69 -3
- package/esm/browser/i18n/messages.d.ts +68 -2
- package/esm/browser/i18n/messages.js +138 -6
- 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 +51 -0
- package/esm/browser/style/device.js +3 -0
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +24 -9
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +2 -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 +14 -3
- package/esm/browser/util/desktop.d.ts +18 -1
- package/esm/browser/util/desktop.js +13 -0
- package/esm/browser/util/process.d.ts +26 -1
- package/esm/browser/util/process.js +79 -5
- 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 +3 -2
- package/lib/browser/assistant/assistant.d.ts +5 -0
- package/lib/browser/assistant/assistant.js +24 -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 +17 -8
- 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.d.ts +7 -1
- package/lib/browser/components/composer.js +33 -19
- package/lib/browser/components/connection-bar.js +30 -11
- package/lib/browser/components/conversation-scroll-util.d.ts +5 -0
- package/lib/browser/components/conversation-scroll-util.js +18 -0
- package/lib/browser/components/conversation-scroll.d.ts +12 -2
- package/lib/browser/components/conversation-scroll.js +68 -5
- 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/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 +3 -38
- package/lib/browser/components/mermaid-view.js +45 -3
- package/lib/browser/components/message-footer.d.ts +2 -0
- package/lib/browser/components/message-footer.js +8 -0
- package/lib/browser/components/message-list.d.ts +12 -0
- package/lib/browser/components/message-list.js +153 -20
- package/lib/browser/components/phone-shell.d.ts +7 -2
- package/lib/browser/components/phone-shell.js +7 -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.js +15 -3
- package/lib/browser/components/settings-controls.js +3 -3
- package/lib/browser/components/settings-parts.js +13 -1
- 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/web-composer.js +2 -1
- 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 +8 -0
- package/lib/browser/extension/web-api-components.d.ts +3 -3
- package/lib/browser/extension/web-api-contributions.d.ts +119 -0
- package/lib/browser/extension/web-extension-api.d.ts +23 -46
- package/lib/browser/extension/web-extension-context.d.ts +6 -1
- package/lib/browser/extension/web-extension-context.js +63 -6
- package/lib/browser/extension/web-extension-protocol.d.ts +5 -1
- package/lib/browser/extension/web-extension-protocol.js +1 -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 +9 -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 +69 -3
- package/lib/browser/i18n/messages.d.ts +68 -2
- package/lib/browser/i18n/messages.js +138 -6
- 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 +51 -0
- package/lib/browser/style/device.js +3 -0
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +24 -9
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +2 -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 +14 -3
- package/lib/browser/util/desktop.d.ts +18 -1
- package/lib/browser/util/desktop.js +13 -0
- package/lib/browser/util/process.d.ts +26 -1
- package/lib/browser/util/process.js +79 -5
- 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
|
@@ -56,6 +56,7 @@ const app_nav_1 = require("./app-nav");
|
|
|
56
56
|
const app_shell_hooks_1 = require("./app-shell-hooks");
|
|
57
57
|
const auth_view_1 = require("./auth-view");
|
|
58
58
|
const board_1 = require("./board");
|
|
59
|
+
const chat_asks_1 = require("./chat-asks");
|
|
59
60
|
const chat_icon_1 = require("./chat-icon");
|
|
60
61
|
const chat_list_1 = require("./chat-list");
|
|
61
62
|
const chat_seen_1 = require("./chat-seen");
|
|
@@ -106,6 +107,7 @@ function AppShell() {
|
|
|
106
107
|
const [chatsByDirectory, setChatsByDirectory] = (0, hooks_1.usePersisted)(chat_list_1.BY_DIRECTORY);
|
|
107
108
|
const [foldedChats, setFoldedChats] = (0, hooks_1.usePersisted)(chat_list_1.FOLDED);
|
|
108
109
|
const [pinnedChats, setPinnedChats] = (0, hooks_1.usePersisted)(chat_list_1.PINNED);
|
|
110
|
+
const [letGoAsks, setLetGoAsks] = (0, hooks_1.usePersisted)(chat_asks_1.LET_GO_ASKS);
|
|
109
111
|
const [navOpen, setNavOpen] = React.useState(false);
|
|
110
112
|
const layout = (0, device_1.useDevice)(device => device.layout);
|
|
111
113
|
const touch = (0, device_1.useDevice)(device => device.touch);
|
|
@@ -430,7 +432,13 @@ function AppShell() {
|
|
|
430
432
|
showPage('');
|
|
431
433
|
}
|
|
432
434
|
};
|
|
433
|
-
const chats = (React.createElement(assistant_chat_list_1.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,
|
|
435
|
+
const chats = (React.createElement(assistant_chat_list_1.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 => {
|
|
436
|
+
var _a;
|
|
437
|
+
const at = (_a = entry.asking) === null || _a === void 0 ? void 0 : _a.at;
|
|
438
|
+
if (at !== undefined) {
|
|
439
|
+
setLetGoAsks(before => chat_asks_1.ChatAskUtil.letGo(before, chat_list_1.ChatListUtil.file(entry), at));
|
|
440
|
+
}
|
|
441
|
+
}, onPicked: picked }));
|
|
434
442
|
const sideList = sideView ? React.createElement(app_nav_1.SidebarView, { view: sideView }) : sideComing ? React.createElement(list_skeleton_1.ListSkeleton, null) : chats;
|
|
435
443
|
const editorArea = (React.createElement(editor_area_1.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 = web_extension_protocol_1.WebCwdUtil.shown(extensions)) !== null && _f !== void 0 ? _f : (_c = workbench.server) === null || _c === void 0 ? void 0 : _c.cwd, maximized: maximized, onMaximize: () => setMaximized(!maximized) }));
|
|
436
444
|
// A photo of the scan screen to the double: its conversation shows, the photo goes with what to do with it.
|
|
@@ -512,10 +520,10 @@ function AppShell() {
|
|
|
512
520
|
}
|
|
513
521
|
: {};
|
|
514
522
|
// The chats' tab has the amber dot of their rows while one of them said something unseen, as a messenger's: of
|
|
515
|
-
// those the list shows, so that each dot of the tab has a row to find. Dragged away, all are seen.
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
523
|
+
// those the list shows, so that each dot of the tab has a row to find. Dragged away, all are seen. Those that
|
|
524
|
+
// wait for the user to decide are counted on it, on the rail too, until answered.
|
|
525
|
+
const listedChats = chat_list_1.ChatListUtil.entries(workbench.sessions, workbench.saved, removedChats, undefined, workbench_util_1.WorkbenchUtil.daysAgo(Date.now(), chatSettings.chatArchiveDays), chat_list_1.ChatListUtil.keptFiles(workbench.saved, pinnedChats, letGoAsks), chat_icon_1.ChatIconUtil.archiveSince(extensions.chatIcons, Date.now())).listed;
|
|
526
|
+
const chatsAsking = chat_asks_1.ChatAskUtil.count(listedChats, letGoAsks);
|
|
519
527
|
const inFront = looking ? workbench.sessions.find(session => session.sessionId === looking) : undefined;
|
|
520
528
|
const chatsUnseen = chat_seen_1.ChatSeenUtil.anyUnseen(listedChats, seenChats, inFront && chat_list_1.ChatListUtil.file(inFront));
|
|
521
529
|
const seeAllChats = () => state.set(chat_seen_1.SEEN_CHATS, chat_seen_1.ChatSeenUtil.seeAll(state.get(chat_seen_1.SEEN_CHATS), listedChats, Date.now()));
|
|
@@ -526,7 +534,7 @@ function AppShell() {
|
|
|
526
534
|
fold: t('ta.nav.fold'),
|
|
527
535
|
settings: { label: t('ta.nav.settings'), run: () => openSettings('navigation') },
|
|
528
536
|
holds,
|
|
529
|
-
}).map(item => (item.id === '' && chatsUnseen ? { ...item, unseen:
|
|
537
|
+
}).map(item => (item.id === '' && (chatsUnseen || chatsAsking) ? { ...item, unseen: chatsUnseen, onSeeAll: seeAllChats, asks: chatsAsking } : item))
|
|
530
538
|
: [];
|
|
531
539
|
const tab = tabPage === 'me' ? nav_places_1.ME_TAB : tabPage === 'discover' ? nav_places_1.DISCOVER : ((_g = tabView === null || tabView === void 0 ? void 0 : tabView.id) !== null && _g !== void 0 ? _g : side);
|
|
532
540
|
// The launcher and the board are over the first tab only, as WeChat's over its chats.
|
|
@@ -556,7 +564,7 @@ function AppShell() {
|
|
|
556
564
|
setSettings(undefined);
|
|
557
565
|
setNavOpen(false);
|
|
558
566
|
setTabPage('discover');
|
|
559
|
-
}, onSettings: openSettings, settingsShown: settings !== undefined, surfaces: surfaces, surface: surface, onSurface: setSurface, holds: holds }),
|
|
567
|
+
}, onSettings: openSettings, settingsShown: settings !== undefined, surfaces: surfaces, surface: surface, onSurface: setSurface, holds: holds, asks: chatsAsking }),
|
|
560
568
|
sideShown && (React.createElement("div", { className: "ta-sidebar", style: (0, split_pane_1.paneStyle)(sidebar) },
|
|
561
569
|
sideList,
|
|
562
570
|
React.createElement(split_pane_1.Sash, { pane: sidebar, side: "start", label: t('ta.layout.sidebar') })))),
|
|
@@ -577,7 +585,8 @@ function AppShell() {
|
|
|
577
585
|
React.createElement(extension_view_1.SessionAvatars.Provider, { value: extensions.avatars },
|
|
578
586
|
React.createElement(chat_icon_1.ChatIconsProvider, { entries: extensions.chatIcons },
|
|
579
587
|
React.createElement(extension_view_1.SessionMenus.Provider, { value: extensions.sessionMenus },
|
|
580
|
-
React.createElement(
|
|
588
|
+
React.createElement(extension_view_1.LoadedExtensions.Provider, { value: extensions.extensions },
|
|
589
|
+
React.createElement(workbench_toggle_1.WorkbenchToggleContext.Provider, { value: toggle }, content)))))))))));
|
|
581
590
|
}
|
|
582
591
|
/** The app, with the look the user picked for the double (every ta below draws it) and the picker of that look. */
|
|
583
592
|
function AppView() {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/** 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. */
|
|
3
|
+
export declare function AsksBadge({ count }: {
|
|
4
|
+
count: number;
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
//# sourceMappingURL=asks-badge.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.AsksBadge = AsksBadge;
|
|
37
|
+
const React = __importStar(require("react"));
|
|
38
|
+
const use_t_1 = require("../i18n/use-t");
|
|
39
|
+
/** 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. */
|
|
40
|
+
function AsksBadge({ count }) {
|
|
41
|
+
const t = (0, use_t_1.useT)();
|
|
42
|
+
return (React.createElement("span", { className: "ta-asks-badge", role: "img", "aria-label": t('ta.chat.asksCount', { count }) }, count > 99 ? '99+' : count));
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=asks-badge.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { TaAsking, TaSavedSessionInfo, TaSessionInfo } from '@celljs/ta-protocol';
|
|
2
|
+
import type { WebAsk } from '../extension/web-api-contributions';
|
|
3
|
+
import type { StateSpec } from '../state/state-protocol';
|
|
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
|
+
}
|
|
47
|
+
//# sourceMappingURL=chat-asks.d.ts.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatAskUtil = exports.LET_GO_ASKS = void 0;
|
|
4
|
+
/** The asks let go remembered at most: past that, the oldest are forgotten, which are long answered. */
|
|
5
|
+
const KEPT = 100;
|
|
6
|
+
/** The same on every device: one let go on the phone is let go on the computer too. */
|
|
7
|
+
exports.LET_GO_ASKS = {
|
|
8
|
+
key: 'chat.letGoAsks',
|
|
9
|
+
tier: 'user',
|
|
10
|
+
initial: {},
|
|
11
|
+
parse: value => ChatAskUtil.parse(value),
|
|
12
|
+
merge: (local, remote) => ChatAskUtil.merge(local, remote),
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Which conversations wait for the user to decide: their last turn asked (TaSessionInfo.asking) and no message of
|
|
16
|
+
* theirs came since, or a dialog waits. Unlike a dot of something unseen, seeing it does not end it; answering does,
|
|
17
|
+
* typed or tapped, or letting it go.
|
|
18
|
+
*/
|
|
19
|
+
var ChatAskUtil;
|
|
20
|
+
(function (ChatAskUtil) {
|
|
21
|
+
function parse(value) {
|
|
22
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
return Object.fromEntries(Object.entries(value).filter(([, at]) => typeof at === 'number'));
|
|
26
|
+
}
|
|
27
|
+
ChatAskUtil.parse = parse;
|
|
28
|
+
/** Each let go as late as either page let it go; `a` itself when `b` adds nothing. */
|
|
29
|
+
function merge(a, b) {
|
|
30
|
+
const later = Object.entries(b).filter(([file, at]) => { var _a; return at > ((_a = a[file]) !== null && _a !== void 0 ? _a : 0); });
|
|
31
|
+
return later.length ? keep({ ...a, ...Object.fromEntries(later) }) : a;
|
|
32
|
+
}
|
|
33
|
+
ChatAskUtil.merge = merge;
|
|
34
|
+
/** Lets the ask of the conversation go, as it was asked at `at`. */
|
|
35
|
+
function letGo(before, file, at) {
|
|
36
|
+
var _a;
|
|
37
|
+
return ((_a = before[file]) !== null && _a !== void 0 ? _a : 0) >= at ? before : keep({ ...before, [file]: at });
|
|
38
|
+
}
|
|
39
|
+
ChatAskUtil.letGo = letGo;
|
|
40
|
+
function keep(letGo) {
|
|
41
|
+
const files = Object.keys(letGo);
|
|
42
|
+
if (files.length <= KEPT) {
|
|
43
|
+
return letGo;
|
|
44
|
+
}
|
|
45
|
+
const kept = files.sort((x, y) => letGo[y] - letGo[x]).slice(0, KEPT);
|
|
46
|
+
return Object.fromEntries(kept.map(file => [file, letGo[file]]));
|
|
47
|
+
}
|
|
48
|
+
function fileOf(entry) {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
return (_b = (_a = entry.sessionFile) !== null && _a !== void 0 ? _a : entry.sessionId) !== null && _b !== void 0 ? _b : '';
|
|
51
|
+
}
|
|
52
|
+
/** What it still asks the user: none once answered or let go. */
|
|
53
|
+
function asking(entry, letGo) {
|
|
54
|
+
var _a;
|
|
55
|
+
const { asking } = entry;
|
|
56
|
+
return asking && asking.at > ((_a = letGo[fileOf(entry)]) !== null && _a !== void 0 ? _a : -1) ? asking : undefined;
|
|
57
|
+
}
|
|
58
|
+
ChatAskUtil.asking = asking;
|
|
59
|
+
/** Whether it waits for the user: it asks, or a dialog of it waits. */
|
|
60
|
+
function waits(entry, letGo) {
|
|
61
|
+
return !!entry.waiting || !!asking(entry, letGo);
|
|
62
|
+
}
|
|
63
|
+
ChatAskUtil.waits = waits;
|
|
64
|
+
/** How many of the conversations the list shows wait for the user: the count on the tab of the chats. */
|
|
65
|
+
function count(entries, letGo) {
|
|
66
|
+
return entries.filter(entry => waits(entry, letGo)).length;
|
|
67
|
+
}
|
|
68
|
+
ChatAskUtil.count = count;
|
|
69
|
+
/**
|
|
70
|
+
* The conversations that wait for the user, for extensions (ui.useAsks): the open ones and those saved, but those a
|
|
71
|
+
* package opened for a role of its own and closed (the list leaves them out), the latest ask first.
|
|
72
|
+
*/
|
|
73
|
+
function list(sessions, saved, letGo) {
|
|
74
|
+
const open = new Set(sessions.map(session => session.sessionFile));
|
|
75
|
+
const closed = saved.filter(session => !session.group && !open.has(session.sessionFile));
|
|
76
|
+
return apart([...sessions, ...closed], letGo).asking.map(entry => {
|
|
77
|
+
var _a, _b;
|
|
78
|
+
var _c;
|
|
79
|
+
const question = (_a = asking(entry, letGo)) === null || _a === void 0 ? void 0 : _a.question;
|
|
80
|
+
return {
|
|
81
|
+
sessionFile: fileOf(entry),
|
|
82
|
+
sessionId: 'sessionId' in entry ? entry.sessionId : undefined,
|
|
83
|
+
cwd: entry.cwd,
|
|
84
|
+
title: entry.sessionName || entry.firstMessage || '',
|
|
85
|
+
...(question && !entry.waiting ? { question } : {}),
|
|
86
|
+
at: (_c = (_b = entry.asking) === null || _b === void 0 ? void 0 : _b.at) !== null && _c !== void 0 ? _c : entry.updatedAt,
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
ChatAskUtil.list = list;
|
|
91
|
+
/** Those that wait for the user, a dialog first, then the latest ask first; and the rest, in the order they had. */
|
|
92
|
+
function apart(entries, letGo) {
|
|
93
|
+
const asking = [];
|
|
94
|
+
const rest = [];
|
|
95
|
+
for (const entry of entries) {
|
|
96
|
+
(waits(entry, letGo) ? asking : rest).push(entry);
|
|
97
|
+
}
|
|
98
|
+
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)); };
|
|
99
|
+
asking.sort((x, y) => rank(y) - rank(x));
|
|
100
|
+
return { asking, rest };
|
|
101
|
+
}
|
|
102
|
+
ChatAskUtil.apart = apart;
|
|
103
|
+
})(ChatAskUtil || (exports.ChatAskUtil = ChatAskUtil = {}));
|
|
104
|
+
//# sourceMappingURL=chat-asks.js.map
|
|
@@ -5,6 +5,7 @@ import type { TaChat } from '../chat/chat-protocol';
|
|
|
5
5
|
import type { MessageId } from '../i18n/messages';
|
|
6
6
|
import { type Translate } from '../i18n/use-t';
|
|
7
7
|
import { type StateSpec } from '../state/state-protocol';
|
|
8
|
+
import { type LetGoAsks } from './chat-asks';
|
|
8
9
|
import { type ChatSeen } from './chat-seen';
|
|
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,5 +191,5 @@ 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;
|
|
189
195
|
//# sourceMappingURL=chat-list.d.ts.map
|
|
@@ -46,6 +46,7 @@ const state_protocol_1 = require("../state/state-protocol");
|
|
|
46
46
|
const message_1 = require("../util/message");
|
|
47
47
|
const workbench_util_1 = require("../workbench-util");
|
|
48
48
|
const busy_1 = require("./busy");
|
|
49
|
+
const chat_asks_1 = require("./chat-asks");
|
|
49
50
|
const chat_icon_1 = require("./chat-icon");
|
|
50
51
|
const chat_seen_1 = require("./chat-seen");
|
|
51
52
|
const context_menu_1 = require("./context-menu");
|
|
@@ -100,6 +101,12 @@ var ChatListUtil;
|
|
|
100
101
|
return (_a = entry.sessionFile) !== null && _a !== void 0 ? _a : entry.sessionId;
|
|
101
102
|
}
|
|
102
103
|
ChatListUtil.file = file;
|
|
104
|
+
/** The files the list keeps however old (ChatListUtil.entries): those pinned, and the saved ones that still ask the user. */
|
|
105
|
+
function keptFiles(saved, pinned, letGo) {
|
|
106
|
+
const asking = saved.filter(session => chat_asks_1.ChatAskUtil.asking(session, letGo)).map(session => session.sessionFile);
|
|
107
|
+
return asking.length ? [...pinned, ...asking] : pinned;
|
|
108
|
+
}
|
|
109
|
+
ChatListUtil.keptFiles = keptFiles;
|
|
103
110
|
/** Those pinned, and the rest, each in the order it had. */
|
|
104
111
|
function pinnedApart(sessions, pinned) {
|
|
105
112
|
const files = new Set(pinned);
|
|
@@ -373,12 +380,19 @@ function ChatState({ streaming, waiting, task }) {
|
|
|
373
380
|
}
|
|
374
381
|
return null;
|
|
375
382
|
}
|
|
376
|
-
/**
|
|
377
|
-
|
|
383
|
+
/**
|
|
384
|
+
* Always there, so that it grows in and goes, the avatar never drawn again; told only while it is on. A conversation
|
|
385
|
+
* that waits for the user to decide has a blue ? instead, over an amber dot: seeing it does not end it, answering does.
|
|
386
|
+
*/
|
|
387
|
+
function ChatDot({ unseen, asks }) {
|
|
378
388
|
const t = (0, use_t_1.useT)();
|
|
379
|
-
|
|
389
|
+
if (asks) {
|
|
390
|
+
return (React.createElement("span", { className: "ta-chat-dot ta-on ta-asks", role: "img", "aria-label": t('ta.chat.asking') }, "?"));
|
|
391
|
+
}
|
|
392
|
+
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" });
|
|
380
393
|
}
|
|
381
|
-
const ChatItem = React.memo(function ChatItem({ session, source, selected, time, compact, actions, restorable, task, doubleName, handable, pinned, unseen, }) {
|
|
394
|
+
const ChatItem = React.memo(function ChatItem({ session, source, selected, time, compact, actions, restorable, task, doubleName, handable, pinned, unseen, asking, }) {
|
|
395
|
+
var _a;
|
|
382
396
|
const t = (0, use_t_1.useT)();
|
|
383
397
|
const onSelect = () => actions.open(session);
|
|
384
398
|
const [removing, run] = (0, busy_1.useBusy)();
|
|
@@ -394,6 +408,7 @@ const ChatItem = React.memo(function ChatItem({ session, source, selected, time,
|
|
|
394
408
|
const [menu, openMenu] = (0, context_menu_1.useContextMenu)();
|
|
395
409
|
const onContextMenu = (event) => openMenu(event, [
|
|
396
410
|
{ label: t('ta.chat.open'), run: onSelect },
|
|
411
|
+
...(asking ? [{ label: t('ta.chat.letGo'), run: () => actions.letGo(session) }] : []),
|
|
397
412
|
...(onPin ? [{ label: t(pinned ? 'ta.chat.unpin' : 'ta.chat.pin'), run: onPin }] : []),
|
|
398
413
|
...(onHand ? [{ label: t('ta.chat.handToDouble'), run: onHand }] : []),
|
|
399
414
|
// What extensions add (Share…) before taking it out, which stays last.
|
|
@@ -413,24 +428,25 @@ const ChatItem = React.memo(function ChatItem({ session, source, selected, time,
|
|
|
413
428
|
// A dialog of it waits for the user: it needs them, it does not answer meanwhile.
|
|
414
429
|
const waiting = ChatListUtil.isOpen(session) && !!session.waiting;
|
|
415
430
|
const streaming = ChatListUtil.isOpen(session) && session.isStreaming && !waiting;
|
|
416
|
-
const
|
|
431
|
+
const asks = waiting || (!!asking && !streaming);
|
|
432
|
+
const mood = asks ? 'attention' : streaming ? 'working' : 'idle';
|
|
417
433
|
const state = React.createElement(ChatState, { streaming: streaming, waiting: waiting, task: task });
|
|
418
434
|
// As in a messaging app, the last thing said; its directory before the first, and on hover in place of its time.
|
|
419
435
|
const said = ChatListUtil.preview(session, title);
|
|
420
436
|
const place = who ? message_1.MessageUtil.basename(session.cwd) : source.label;
|
|
421
437
|
const ended = task === 'failed' || task === 'stopped' ? task : undefined;
|
|
422
|
-
return (React.createElement(swipe_row_1.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 },
|
|
438
|
+
return (React.createElement(swipe_row_1.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 },
|
|
423
439
|
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" },
|
|
424
440
|
React.createElement("span", { className: "ta-chat-line" },
|
|
425
441
|
who && React.createElement(ChatAvatar, { session: session, source: source, who: who, size: 20, mood: mood }),
|
|
426
442
|
tag,
|
|
427
443
|
React.createElement("span", { className: "ta-chat-title" }, title),
|
|
428
444
|
state,
|
|
429
|
-
React.createElement(
|
|
445
|
+
React.createElement(ChatDot, { unseen: !!unseen, asks: asks }),
|
|
430
446
|
React.createElement("span", { className: "ta-chat-time" }, removing && handheld ? React.createElement("span", { className: "ta-spinner ta-later" }) : time)))) : (React.createElement(React.Fragment, null,
|
|
431
447
|
React.createElement("span", { className: "ta-chat-avatar-box" },
|
|
432
448
|
React.createElement(ChatAvatar, { session: session, source: source, who: who, size: 38, mood: mood }),
|
|
433
|
-
React.createElement(
|
|
449
|
+
React.createElement(ChatDot, { unseen: !!unseen, asks: asks })),
|
|
434
450
|
React.createElement("span", { className: "ta-chat-text" },
|
|
435
451
|
React.createElement("span", { className: "ta-chat-line" },
|
|
436
452
|
tag,
|
|
@@ -446,10 +462,14 @@ const ChatItem = React.memo(function ChatItem({ session, source, selected, time,
|
|
|
446
462
|
"[",
|
|
447
463
|
t('ta.task.waiting'),
|
|
448
464
|
"]"),
|
|
449
|
-
|
|
465
|
+
asks && !waiting && React.createElement("span", { className: "ta-chat-flag ta-waiting" },
|
|
466
|
+
"[",
|
|
467
|
+
t('ta.chat.asking'),
|
|
468
|
+
"]"),
|
|
469
|
+
ended && !streaming && !asks && (React.createElement("span", { className: `ta-chat-flag ta-${ended}` },
|
|
450
470
|
"[",
|
|
451
471
|
t(ended === 'failed' ? 'ta.task.failed' : 'ta.task.stopped'),
|
|
452
|
-
"]")), said !== null &&
|
|
472
|
+
"]")), (_a = (asks && !waiting ? asking : said)) !== null && _a !== void 0 ? _a : (React.createElement("span", { className: "ta-chat-dir" },
|
|
453
473
|
React.createElement(icon_1.Icon, { icon: lucide_react_1.Folder, size: 12 }),
|
|
454
474
|
place))),
|
|
455
475
|
streaming && React.createElement("span", { className: "ta-chat-state ta-spinner" })))))),
|
|
@@ -462,7 +482,7 @@ const ChatItem = React.memo(function ChatItem({ session, source, selected, time,
|
|
|
462
482
|
* opened or searched, and those taken out last, folded, to put back. However long, it draws the rows of
|
|
463
483
|
* its first screens, and more as it is scrolled to its end.
|
|
464
484
|
*/
|
|
465
|
-
function ChatList({ sessions, saved, removed: removedFiles, archived: archivedSaved, onArchive, foldDays, archiveDays, selected, chat, byDirectory, onByDirectory, folded, onFolded, onPicked, double, notice, pinned, onPinned, looking, seen, }) {
|
|
485
|
+
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, }) {
|
|
466
486
|
const t = (0, use_t_1.useT)();
|
|
467
487
|
const now = useMinute();
|
|
468
488
|
const [query, setQuery] = React.useState('');
|
|
@@ -476,8 +496,8 @@ function ChatList({ sessions, saved, removed: removedFiles, archived: archivedSa
|
|
|
476
496
|
const pageCount = typeof IntersectionObserver === 'undefined' ? Number.POSITIVE_INFINITY : paged.query === query ? paged.count : exports.CHAT_PAGE;
|
|
477
497
|
// What the rows do reads the props of now, through one object that stays the same: no row is drawn again for it.
|
|
478
498
|
const sessionMenus = React.useContext(extension_view_1.SessionMenus);
|
|
479
|
-
const latest = React.useRef({ chat, double, onPicked, t, pinned, onPinned, sessionMenus });
|
|
480
|
-
latest.current = { chat, double, onPicked, t, pinned, onPinned, sessionMenus };
|
|
499
|
+
const latest = React.useRef({ chat, double, onPicked, t, pinned, onPinned, sessionMenus, onLetGo });
|
|
500
|
+
latest.current = { chat, double, onPicked, t, pinned, onPinned, sessionMenus, onLetGo };
|
|
481
501
|
const actions = React.useMemo(() => {
|
|
482
502
|
const pick = (change) => {
|
|
483
503
|
void change;
|
|
@@ -499,6 +519,7 @@ function ChatList({ sessions, saved, removed: removedFiles, archived: archivedSa
|
|
|
499
519
|
const others = latest.current.pinned.filter(other => other !== file);
|
|
500
520
|
latest.current.onPinned(pin ? [file, ...others] : others);
|
|
501
521
|
},
|
|
522
|
+
letGo: entry => latest.current.onLetGo(entry),
|
|
502
523
|
extensionMenu: (entry, title) => {
|
|
503
524
|
const open = ChatListUtil.isOpen(entry);
|
|
504
525
|
const session = {
|
|
@@ -526,13 +547,16 @@ function ChatList({ sessions, saved, removed: removedFiles, archived: archivedSa
|
|
|
526
547
|
const icons = React.useContext(extension_view_1.ChatIcons);
|
|
527
548
|
// biome-ignore lint/correctness/useExhaustiveDependencies: its bounds move with the day, as `since` does
|
|
528
549
|
const sooner = React.useMemo(() => chat_icon_1.ChatIconUtil.archiveSince(icons.entries, now), [icons, since]);
|
|
529
|
-
|
|
550
|
+
// One that waits for the user is not archived, however old, as one pinned.
|
|
551
|
+
const kept = React.useMemo(() => ChatListUtil.keptFiles([...saved, ...(archivedSaved !== null && archivedSaved !== void 0 ? archivedSaved : [])], pinned, letGo), [saved, archivedSaved, pinned, letGo]);
|
|
552
|
+
const { listed, archived, removed } = React.useMemo(() => ChatListUtil.entries(sessions, saved, removedFiles, archivedSaved, since, kept, sooner), [sessions, saved, removedFiles, archivedSaved, since, kept, sooner]);
|
|
530
553
|
const sources = React.useMemo(() => ChatListUtil.sources(listed), [listed]);
|
|
531
554
|
// A search finds the archived too.
|
|
532
555
|
const shown = React.useMemo(() => ChatListUtil.filter(searching ? [...listed, ...archived] : listed, query, t), [listed, archived, searching, query, t]);
|
|
533
556
|
const shownRemoved = React.useMemo(() => ChatListUtil.filter(removed, query, t), [removed, query, t]);
|
|
534
|
-
// Those
|
|
535
|
-
const
|
|
557
|
+
// Those that wait for the user to decide are at the very top, then those pinned, whatever their day or directory.
|
|
558
|
+
const asks = React.useMemo(() => (searching ? { asking: [], rest: shown } : chat_asks_1.ChatAskUtil.apart(shown, letGo)), [shown, letGo, searching]);
|
|
559
|
+
const apart = React.useMemo(() => ChatListUtil.pinnedApart(asks.rest, pinned), [asks.rest, pinned]);
|
|
536
560
|
const lookedAt = looking ? sessions.find(session => session.sessionId === looking) : undefined;
|
|
537
561
|
const inFront = lookedAt && ChatListUtil.file(lookedAt);
|
|
538
562
|
// What a search finds is one list by day, wherever it is.
|
|
@@ -560,7 +584,7 @@ function ChatList({ sessions, saved, removed: removedFiles, archived: archivedSa
|
|
|
560
584
|
const stays = (session) => isSelected(session) || isUnseen(session);
|
|
561
585
|
const budget = ChatListUtil.budget(pageCount, stays);
|
|
562
586
|
const pinnedFiles = React.useMemo(() => new Set(pinned), [pinned]);
|
|
563
|
-
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) }));
|
|
587
|
+
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 = chat_asks_1.ChatAskUtil.asking(session, letGo)) === null || _a === void 0 ? void 0 : _a.question })); };
|
|
564
588
|
// The conversation shown is found in the list, however it came to be shown: out of a search that hides it, and scrolled to.
|
|
565
589
|
const scroller = React.useRef(null);
|
|
566
590
|
const end = React.useRef(null);
|
|
@@ -669,6 +693,11 @@ function ChatList({ sessions, saved, removed: removedFiles, archived: archivedSa
|
|
|
669
693
|
React.createElement(icon_1.IconButton, { className: "ta-chats-add", icon: lucide_react_1.Plus, label: t('ta.chat.new'), onClick: () => pick(chat.draft()) })),
|
|
670
694
|
notice,
|
|
671
695
|
React.createElement("div", { className: "ta-side-scroll", ref: scroller },
|
|
696
|
+
asks.asking.length > 0 && (React.createElement("section", { className: "ta-chat-section ta-chat-asks" },
|
|
697
|
+
React.createElement("div", { className: "ta-chat-section-title" },
|
|
698
|
+
t('ta.chat.asks'),
|
|
699
|
+
React.createElement("span", { className: "ta-chat-asks-count" }, asks.asking.length)),
|
|
700
|
+
React.createElement("ul", { className: "ta-side-list" }, asks.asking.map(session => item(session))))),
|
|
672
701
|
apart.pinned.length > 0 && (React.createElement("section", { className: "ta-chat-section ta-chat-pinned" },
|
|
673
702
|
React.createElement("div", { className: "ta-chat-section-title" }, t('ta.chat.pinned')),
|
|
674
703
|
React.createElement("ul", { className: "ta-side-list" }, apart.pinned.map(session => item(session))))),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { WebComposerAction, WebConversation } from '../extension/web-extension-api';
|
|
3
|
+
import type { WebComposerAddonEntry } from '../extension/web-extension-protocol';
|
|
4
|
+
import type { ComposerAction } from './composer-box';
|
|
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
|
+
}
|
|
12
|
+
//# sourceMappingURL=composer-addon-util.d.ts.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ComposerAddonUtil = void 0;
|
|
37
|
+
const React = __importStar(require("react"));
|
|
38
|
+
var ComposerAddonUtil;
|
|
39
|
+
(function (ComposerAddonUtil) {
|
|
40
|
+
function action(entry) {
|
|
41
|
+
const { items, icon: given, ...rest } = entry;
|
|
42
|
+
const drawn = { ...rest, icon: icon(given) };
|
|
43
|
+
return items ? { ...drawn, items: items.map(action) } : drawn;
|
|
44
|
+
}
|
|
45
|
+
ComposerAddonUtil.action = action;
|
|
46
|
+
/** An icon given as a component (`ui.icons.Eye`), which React cannot draw as a child, is drawn at 16 pixels. */
|
|
47
|
+
function icon(given) {
|
|
48
|
+
const component = typeof given === 'function' || (typeof given === 'object' && given !== null && '$$typeof' in given && !React.isValidElement(given));
|
|
49
|
+
if (component) {
|
|
50
|
+
const Icon = given;
|
|
51
|
+
return React.createElement(Icon, { size: 16 });
|
|
52
|
+
}
|
|
53
|
+
return given;
|
|
54
|
+
}
|
|
55
|
+
ComposerAddonUtil.icon = icon;
|
|
56
|
+
/** The entries of each addon, a section each; an addon that fails adds none. */
|
|
57
|
+
function actions(addons, conversation) {
|
|
58
|
+
if (!conversation) {
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
return addons.flatMap(({ id, addon }) => {
|
|
62
|
+
var _a;
|
|
63
|
+
var _b;
|
|
64
|
+
try {
|
|
65
|
+
const entries = (_b = (_a = addon.actions) === null || _a === void 0 ? void 0 : _a.call(addon, conversation)) !== null && _b !== void 0 ? _b : [];
|
|
66
|
+
return entries.length > 0 ? [entries.map(action)] : [];
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
console.error(`The composer addon ${id} failed:`, error);
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
ComposerAddonUtil.actions = actions;
|
|
75
|
+
})(ComposerAddonUtil || (exports.ComposerAddonUtil = ComposerAddonUtil = {}));
|
|
76
|
+
//# 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';
|
|
2
|
+
import type { WebConversation } from '../extension/web-extension-api';
|
|
4
3
|
import type { ComposerAction } from './composer-box';
|
|
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.
|