@celljs/ta-web 4.22.0 → 4.24.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/esm/browser/assistant/assistant-chat-list.js +3 -1
- package/esm/browser/assistant/assistant-conversation.js +1 -1
- package/esm/browser/assistant/assistant-initiative.d.ts +5 -1
- package/esm/browser/assistant/assistant-initiative.js +11 -3
- package/esm/browser/assistant/call-keeper.d.ts +2 -1
- package/esm/browser/assistant/call-keeper.js +4 -2
- package/esm/browser/assistant/call-screen.d.ts +1 -1
- package/esm/browser/assistant/call-turn-end.d.ts +11 -2
- package/esm/browser/assistant/call-turn-end.js +21 -5
- package/esm/browser/assistant/read-aloud.d.ts +1 -1
- package/esm/browser/assistant/realtime-voice.d.ts +1 -1
- package/esm/browser/assistant/voice-call-bar.d.ts +5 -2
- package/esm/browser/assistant/voice-call-bar.js +12 -0
- package/esm/browser/assistant/voice-call-protocol.d.ts +78 -0
- package/esm/browser/assistant/voice-call-protocol.js +2 -0
- package/esm/browser/assistant/voice-call.d.ts +17 -65
- package/esm/browser/assistant/voice-call.js +45 -1
- package/esm/browser/assistant/voice-reopen.d.ts +1 -1
- package/esm/browser/components/account-menu.js +28 -7
- package/esm/browser/components/app-shell-state.js +2 -1
- package/esm/browser/components/app-view.js +15 -7
- package/esm/browser/components/chat-home-util.d.ts +7 -0
- package/esm/browser/components/chat-home-util.js +10 -0
- package/esm/browser/components/chat-home.d.ts +3 -1
- package/esm/browser/components/chat-home.js +3 -2
- package/esm/browser/components/chat-list-util.d.ts +15 -3
- package/esm/browser/components/chat-list-util.js +26 -4
- package/esm/browser/components/chat-list.js +4 -3
- package/esm/browser/components/chat-seen.d.ts +4 -3
- package/esm/browser/components/chat-seen.js +6 -5
- package/esm/browser/components/chats-dot.d.ts +30 -0
- package/esm/browser/components/chats-dot.js +32 -0
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/earlier-messages.d.ts +4 -0
- package/esm/browser/components/earlier-messages.js +10 -2
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/message-footer.d.ts +0 -2
- package/esm/browser/components/message-footer.js +1 -8
- package/esm/browser/components/message-images.d.ts +22 -0
- package/esm/browser/components/message-images.js +90 -1
- package/esm/browser/components/message-steps.js +9 -0
- package/esm/browser/components/message-user.js +8 -1
- package/esm/browser/components/partner-row-util.d.ts +28 -0
- package/esm/browser/components/partner-row-util.js +45 -0
- package/esm/browser/components/partner-row.d.ts +4 -3
- package/esm/browser/components/partner-row.js +21 -9
- package/esm/browser/components/profile-view.d.ts +2 -2
- package/esm/browser/components/profile-view.js +6 -3
- package/esm/browser/components/settings-files.d.ts +7 -0
- package/esm/browser/components/settings-files.js +61 -0
- package/esm/browser/components/settings-more.js +2 -0
- package/esm/browser/components/tool-view.js +23 -7
- package/esm/browser/components/web-composer.d.ts +5 -2
- package/esm/browser/components/web-composer.js +10 -5
- package/esm/browser/extension/extension-view.js +2 -2
- package/esm/browser/extension/icons.js +4 -1
- package/esm/browser/extension/web-api-call.d.ts +45 -0
- package/esm/browser/extension/web-api-call.js +2 -0
- package/esm/browser/extension/web-api-components.d.ts +37 -2
- package/esm/browser/extension/web-api-contributions.d.ts +4 -32
- package/esm/browser/extension/web-api-partners.d.ts +27 -2
- package/esm/browser/extension/web-extension-api.d.ts +9 -12
- package/esm/browser/extension/web-extension-context.d.ts +2 -3
- package/esm/browser/extension/web-extension-context.js +5 -5
- package/esm/browser/extension/web-view-util.d.ts +5 -0
- package/esm/browser/extension/web-view-util.js +8 -0
- package/esm/browser/i18n/locales.d.ts +18 -1
- package/esm/browser/i18n/messages-ja.js +17 -0
- package/esm/browser/i18n/messages-zh-tw.js +17 -0
- package/esm/browser/i18n/messages.d.ts +17 -0
- package/esm/browser/i18n/messages.js +34 -0
- package/esm/browser/partners/partners-extension.js +17 -0
- package/esm/browser/partners/partners-util.d.ts +6 -0
- package/esm/browser/partners/partners-util.js +9 -0
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +3 -0
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation-column.js +21 -0
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +3 -2
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +8 -0
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +1 -1
- package/esm/browser/util/image-shrink.d.ts +26 -0
- package/esm/browser/util/image-shrink.js +60 -0
- package/esm/browser/util/process.d.ts +10 -4
- package/esm/browser/util/process.js +45 -18
- package/lib/browser/assistant/assistant-chat-list.js +3 -1
- package/lib/browser/assistant/assistant-conversation.js +1 -1
- package/lib/browser/assistant/assistant-initiative.d.ts +5 -1
- package/lib/browser/assistant/assistant-initiative.js +11 -3
- package/lib/browser/assistant/call-keeper.d.ts +2 -1
- package/lib/browser/assistant/call-keeper.js +4 -2
- package/lib/browser/assistant/call-screen.d.ts +1 -1
- package/lib/browser/assistant/call-turn-end.d.ts +11 -2
- package/lib/browser/assistant/call-turn-end.js +22 -6
- package/lib/browser/assistant/read-aloud.d.ts +1 -1
- package/lib/browser/assistant/realtime-voice.d.ts +1 -1
- package/lib/browser/assistant/voice-call-bar.d.ts +5 -2
- package/lib/browser/assistant/voice-call-bar.js +12 -0
- package/lib/browser/assistant/voice-call-protocol.d.ts +79 -0
- package/lib/browser/assistant/voice-call-protocol.js +3 -0
- package/lib/browser/assistant/voice-call.d.ts +17 -65
- package/lib/browser/assistant/voice-call.js +45 -1
- package/lib/browser/assistant/voice-reopen.d.ts +1 -1
- package/lib/browser/components/account-menu.js +27 -6
- package/lib/browser/components/app-shell-state.js +2 -1
- package/lib/browser/components/app-view.js +15 -7
- package/lib/browser/components/chat-home-util.d.ts +7 -0
- package/lib/browser/components/chat-home-util.js +10 -0
- package/lib/browser/components/chat-home.d.ts +3 -1
- package/lib/browser/components/chat-home.js +3 -2
- package/lib/browser/components/chat-list-util.d.ts +15 -3
- package/lib/browser/components/chat-list-util.js +26 -4
- package/lib/browser/components/chat-list.js +4 -3
- package/lib/browser/components/chat-seen.d.ts +4 -3
- package/lib/browser/components/chat-seen.js +6 -5
- package/lib/browser/components/chats-dot.d.ts +31 -0
- package/lib/browser/components/chats-dot.js +68 -0
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/earlier-messages.d.ts +4 -0
- package/lib/browser/components/earlier-messages.js +10 -2
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/message-footer.d.ts +0 -2
- package/lib/browser/components/message-footer.js +0 -8
- package/lib/browser/components/message-images.d.ts +22 -0
- package/lib/browser/components/message-images.js +92 -2
- package/lib/browser/components/message-steps.js +9 -0
- package/lib/browser/components/message-user.js +7 -0
- package/lib/browser/components/partner-row-util.d.ts +29 -0
- package/lib/browser/components/partner-row-util.js +48 -0
- package/lib/browser/components/partner-row.d.ts +4 -3
- package/lib/browser/components/partner-row.js +21 -9
- package/lib/browser/components/profile-view.d.ts +2 -2
- package/lib/browser/components/profile-view.js +6 -3
- package/lib/browser/components/settings-files.d.ts +8 -0
- package/lib/browser/components/settings-files.js +97 -0
- package/lib/browser/components/settings-more.js +2 -0
- package/lib/browser/components/tool-view.js +23 -7
- package/lib/browser/components/web-composer.d.ts +5 -2
- package/lib/browser/components/web-composer.js +10 -5
- package/lib/browser/extension/extension-view.js +2 -2
- package/lib/browser/extension/icons.js +3 -0
- package/lib/browser/extension/web-api-call.d.ts +46 -0
- package/lib/browser/extension/web-api-call.js +3 -0
- package/lib/browser/extension/web-api-components.d.ts +37 -2
- package/lib/browser/extension/web-api-contributions.d.ts +4 -32
- package/lib/browser/extension/web-api-partners.d.ts +27 -2
- package/lib/browser/extension/web-extension-api.d.ts +9 -12
- package/lib/browser/extension/web-extension-context.d.ts +2 -3
- package/lib/browser/extension/web-extension-context.js +5 -5
- package/lib/browser/extension/web-view-util.d.ts +5 -0
- package/lib/browser/extension/web-view-util.js +8 -0
- package/lib/browser/i18n/locales.d.ts +18 -1
- package/lib/browser/i18n/messages-ja.js +17 -0
- package/lib/browser/i18n/messages-zh-tw.js +17 -0
- package/lib/browser/i18n/messages.d.ts +17 -0
- package/lib/browser/i18n/messages.js +34 -0
- package/lib/browser/partners/partners-extension.js +17 -0
- package/lib/browser/partners/partners-util.d.ts +6 -0
- package/lib/browser/partners/partners-util.js +9 -0
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +3 -0
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation-column.js +21 -0
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +3 -2
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +8 -0
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +1 -1
- package/lib/browser/util/image-shrink.d.ts +27 -0
- package/lib/browser/util/image-shrink.js +63 -0
- package/lib/browser/util/process.d.ts +10 -4
- package/lib/browser/util/process.js +45 -18
- package/package.json +7 -7
|
@@ -7,6 +7,7 @@ import { useChat } from '../chat/chat-view.js';
|
|
|
7
7
|
import { useBackLayer, useNoBackLayer } from '../device/back-stack.js';
|
|
8
8
|
import { useDevice } from '../device/device.js';
|
|
9
9
|
import { WebTaskUtil } from '../extension/web-tasks.js';
|
|
10
|
+
import { WebViewUtil } from '../extension/web-view-util.js';
|
|
10
11
|
import { TaFiles } from '../files/files-protocol.js';
|
|
11
12
|
import { useCodeScan, useNotices, useOpenLink, usePersisted, useSettings, useWebExtensions, useWorkbench } from '../hooks.js';
|
|
12
13
|
import { useT } from '../i18n/use-t.js';
|
|
@@ -200,7 +201,7 @@ export function useAppShell() {
|
|
|
200
201
|
setSettings(undefined);
|
|
201
202
|
setTabPage(undefined);
|
|
202
203
|
};
|
|
203
|
-
const tools = [...(hasCards ? [cardsTool] : []), ...extensions.views
|
|
204
|
+
const tools = [...(hasCards ? [cardsTool] : []), ...WebViewUtil.tools(extensions.views)];
|
|
204
205
|
const openTool = (id) => (id === CARDS_ID ? openCards() : host.openView(id));
|
|
205
206
|
// The workbench: the tabs open, or the tools that open there.
|
|
206
207
|
const editors = extensions.editors.length > 0 || tools.length > 0;
|
|
@@ -10,7 +10,6 @@ import { usePersisted } from '../hooks.js';
|
|
|
10
10
|
import { SIGN_IN_EVENT } from '../notices/notices.js';
|
|
11
11
|
import { SharedPageUtil } from '../share/shared-link.js';
|
|
12
12
|
import { SharedPage } from '../share/shared-page.js';
|
|
13
|
-
import { WorkbenchUtil } from '../workbench-util.js';
|
|
14
13
|
import { AppContexts } from './app-contexts.js';
|
|
15
14
|
import { PageView, Rail, SidebarView } from './app-nav.js';
|
|
16
15
|
import { LOGIN_LATER, RAIL } from './app-shell-hooks.js';
|
|
@@ -18,9 +17,9 @@ import { useAppShell } from './app-shell-state.js';
|
|
|
18
17
|
import { AuthUtil, LoginPage, useAuthProviders } from './auth-view.js';
|
|
19
18
|
import { BoardSurface } from './board.js';
|
|
20
19
|
import { ChatAskUtil } from './chat-asks.js';
|
|
21
|
-
import { ChatIconUtil } from './chat-icon.js';
|
|
22
20
|
import { ChatListUtil } from './chat-list-util.js';
|
|
23
21
|
import { ChatSeenUtil, SEEN_CHATS } from './chat-seen.js';
|
|
22
|
+
import { useChatsDot } from './chats-dot.js';
|
|
24
23
|
import { ConnectionBar } from './connection-bar.js';
|
|
25
24
|
import { CustomHost } from './custom-host.js';
|
|
26
25
|
import { DeviceSignInPage } from './device-sign-in-page.js';
|
|
@@ -78,6 +77,20 @@ function AppShell() {
|
|
|
78
77
|
// Where Ta's agents read the page to be, and go (docs/design/ta-app-use.md 3): set below as it renders.
|
|
79
78
|
const screenShell = useScreenNavigator();
|
|
80
79
|
const inCall = useCallGoingOn();
|
|
80
|
+
// The chats' tab, and the double's on the rail, have the amber dot while a row of the double's list has one, as a
|
|
81
|
+
// messenger's; what waits for the user to decide is counted there until answered.
|
|
82
|
+
const { listed: listedChats, unseen: chatsUnseen } = useChatsDot({
|
|
83
|
+
sessions: workbench.sessions,
|
|
84
|
+
saved: workbench.saved,
|
|
85
|
+
removed: removedChats,
|
|
86
|
+
pinned: pinnedChats,
|
|
87
|
+
letGo: letGoAsks,
|
|
88
|
+
archiveDays: chatSettings.chatArchiveDays,
|
|
89
|
+
seen: seenChats,
|
|
90
|
+
looking,
|
|
91
|
+
extensions,
|
|
92
|
+
host,
|
|
93
|
+
});
|
|
81
94
|
if (workbench.status === 'signed-out') {
|
|
82
95
|
return workbench.leaving ? React.createElement("div", { className: "ta-signin" }) : React.createElement(SignIn, { error: workbench.error });
|
|
83
96
|
}
|
|
@@ -216,11 +229,6 @@ function AppShell() {
|
|
|
216
229
|
picked();
|
|
217
230
|
},
|
|
218
231
|
});
|
|
219
|
-
// The chats' tab, and the double's on the rail, have the amber dot of the rows listed while one said something unseen,
|
|
220
|
-
// as a messenger's, but those quiet (a call); what waits for the user to decide is counted there until answered.
|
|
221
|
-
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;
|
|
222
|
-
const inFront = looking ? workbench.sessions.find(session => session.sessionId === looking) : undefined;
|
|
223
|
-
const chatsUnseen = ChatSeenUtil.anyUnseen(ChatIconUtil.loud(extensions.chatIcons, listedChats), seenChats, inFront && ChatListUtil.file(inFront));
|
|
224
232
|
// Dragged away, the dot of the chats: all seen.
|
|
225
233
|
const seeAllChats = () => state.set(SEEN_CHATS, ChatSeenUtil.seeAll(state.get(SEEN_CHATS), listedChats, Date.now()));
|
|
226
234
|
// Dragged away, the count of the double: what the conversations ask let go; the double's own tasks wait on.
|
|
@@ -16,6 +16,8 @@ export interface ChatHome {
|
|
|
16
16
|
* list by their time as any conversation (docs/design/ta-partners.md).
|
|
17
17
|
*/
|
|
18
18
|
partners: readonly WebPartnerEntry[];
|
|
19
|
+
/** The conversations of pi that are partners' (PartnersUtil.sessions): listed once closed too, seen elsewhere till then. */
|
|
20
|
+
partnerSessions: ReadonlyMap<string, number>;
|
|
19
21
|
/** The key of the row whose page is in front, as a conversation of the list is (WebExtensionsState.pageFrom). */
|
|
20
22
|
shownItem?: string;
|
|
21
23
|
/** Opens a row: a page it shows is shown beside the list (TaWebExtensions.openHome). */
|
|
@@ -104,6 +106,11 @@ export declare namespace ChatHomeUtil {
|
|
|
104
106
|
};
|
|
105
107
|
/** It ended after the user last opened it (once the seen were kept): an amber dot, as a conversation's unread. */
|
|
106
108
|
function unseen(task: WebTaskEntry, seen: ChatSeen): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Whether a row of the double's list that is no conversation of pi has the amber dot: a row of its home, a
|
|
111
|
+
* conversation with a partner (a group chat, a chat of two), a task that is no conversation.
|
|
112
|
+
*/
|
|
113
|
+
function anyUnseen(items: readonly WebHomeEntry[], partners: readonly WebPartnerEntry[], tasks: readonly WebTaskEntry[], seen: ChatSeen): boolean;
|
|
107
114
|
/** Whether one of `texts` has the query (any case); all match an empty one. */
|
|
108
115
|
function matches(query: string, ...texts: (string | undefined)[]): boolean;
|
|
109
116
|
/**
|
|
@@ -100,6 +100,16 @@ export var ChatHomeUtil;
|
|
|
100
100
|
return seen.since > 0 && WebTaskUtil.ended(task) && task.endedAt !== undefined && task.endedAt > ((_a = seen.at[seenKey(task)]) !== null && _a !== void 0 ? _a : seen.since);
|
|
101
101
|
}
|
|
102
102
|
ChatHomeUtil.unseen = unseen;
|
|
103
|
+
/**
|
|
104
|
+
* Whether a row of the double's list that is no conversation of pi has the amber dot: a row of its home, a
|
|
105
|
+
* conversation with a partner (a group chat, a chat of two), a task that is no conversation.
|
|
106
|
+
*/
|
|
107
|
+
function anyUnseen(items, partners, tasks, seen) {
|
|
108
|
+
return (ChatHomeUtil.items(items).some(item => item.unseen) ||
|
|
109
|
+
PartnersUtil.chats(partners).some(PartnersUtil.unseen) ||
|
|
110
|
+
ChatHomeUtil.tasks(tasks).rows.some(task => unseen(task, seen)));
|
|
111
|
+
}
|
|
112
|
+
ChatHomeUtil.anyUnseen = anyUnseen;
|
|
103
113
|
/** Whether one of `texts` has the query (any case); all match an empty one. */
|
|
104
114
|
function matches(query, ...texts) {
|
|
105
115
|
const needle = query.trim().toLowerCase();
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import type { WebTaskEntry } from '../extension/web-extension-api.js';
|
|
3
3
|
import { type ChatHome, type ChatHomeCounts, type ChatHomeRow } from './chat-home-util.js';
|
|
4
4
|
/** The text of a row of the chats: its title and time, and under them its line, as a conversation's. */
|
|
5
|
-
export declare function RowText({ title, time, line, unseen, flag, busy, tag, }: {
|
|
5
|
+
export declare function RowText({ title, time, line, unseen, flag, busy, tag, badge, }: {
|
|
6
6
|
title: string;
|
|
7
7
|
time: string;
|
|
8
8
|
line: React.ReactNode;
|
|
@@ -12,6 +12,8 @@ export declare function RowText({ title, time, line, unseen, flag, busy, tag, }:
|
|
|
12
12
|
busy?: boolean;
|
|
13
13
|
/** Before the title: Double, for what it does. */
|
|
14
14
|
tag?: React.ReactNode;
|
|
15
|
+
/** Just after the title, a small label of what it is: Friends, of a group chat with them. */
|
|
16
|
+
badge?: string;
|
|
15
17
|
}): React.JSX.Element;
|
|
16
18
|
/**
|
|
17
19
|
* The double at the top of its list, as a messenger's pinned conversation: its face, what needs the user and goes on
|
|
@@ -9,11 +9,12 @@ import { PartnerRow } from './partner-row.js';
|
|
|
9
9
|
import { SwipeRow } from './swipe-row.js';
|
|
10
10
|
import { DinoFace } from './ta-avatar.js';
|
|
11
11
|
/** The text of a row of the chats: its title and time, and under them its line, as a conversation's. */
|
|
12
|
-
export function RowText({ title, time, line, unseen, flag, busy, tag, }) {
|
|
12
|
+
export function RowText({ title, time, line, unseen, flag, busy, tag, badge, }) {
|
|
13
13
|
return (React.createElement("span", { className: "ta-chat-text" },
|
|
14
14
|
React.createElement("span", { className: "ta-chat-line" },
|
|
15
15
|
tag,
|
|
16
|
-
React.createElement("span", { className:
|
|
16
|
+
React.createElement("span", { className: `ta-chat-title${badge ? ' ta-badged' : ''}` }, title),
|
|
17
|
+
badge && React.createElement("span", { className: "ta-chat-badge" }, badge),
|
|
17
18
|
React.createElement("span", { className: "ta-chat-time" }, time)),
|
|
18
19
|
React.createElement("span", { className: "ta-chat-line" },
|
|
19
20
|
React.createElement("span", { className: `ta-chat-sub${unseen ? ' ta-unseen' : ''}` },
|
|
@@ -5,6 +5,7 @@ import { type StateSpec } from '../state/state-protocol.js';
|
|
|
5
5
|
import { type LetGoAsks } from './chat-asks.js';
|
|
6
6
|
import type { ChatHomeRow, ChatTaskRow } from './chat-home-util.js';
|
|
7
7
|
import type { ChatFolderIcon } from './chat-icon.js';
|
|
8
|
+
import { type ChatSeen } from './chat-seen.js';
|
|
8
9
|
/** Where a conversation belongs: the directory of the user's own, or the package that opened it. */
|
|
9
10
|
export interface ChatSource {
|
|
10
11
|
/** `dir:<cwd>` or `pkg:<package>`. */
|
|
@@ -130,14 +131,25 @@ export declare namespace ChatListUtil {
|
|
|
130
131
|
pinned: T[];
|
|
131
132
|
rest: T[];
|
|
132
133
|
};
|
|
134
|
+
/**
|
|
135
|
+
* Whether a row said something the user has not seen (ChatSeenUtil.unseen): a saved one answers no more, and what
|
|
136
|
+
* a partner's conversation said till it was seen elsewhere (PartnersUtil.sessions) is seen.
|
|
137
|
+
*/
|
|
138
|
+
function unseen(session: ChatEntry, seen: ChatSeen, shown?: string, partnerSessions?: ReadonlyMap<string, number>): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Which saved conversations of a package's group the list has (`entries`): those that fold into a folder of the
|
|
141
|
+
* list (WebChatIcon.folder), and those of partners (an agent's, PartnersUtil.sessions), the double's list having
|
|
142
|
+
* every conversation with a partner. ta serve opens either again with its group and role, from its file.
|
|
143
|
+
*/
|
|
144
|
+
function groupListed(folderOf: ((session: TaSavedSessionInfo) => unknown) | undefined, partnerSessions: ReadonlyMap<string, number> | undefined): ((session: TaSavedSessionInfo) => boolean) | undefined;
|
|
133
145
|
/**
|
|
134
146
|
* The open sessions and the saved ones, those archived and those taken out apart. A saved conversation of a
|
|
135
|
-
* package's group is not listed: its package opens it again, with its role; unless
|
|
136
|
-
*
|
|
147
|
+
* package's group is not listed: its package opens it again, with its role; unless `listed` has it (groupListed:
|
|
148
|
+
* one that folds into a folder of the list, a partner's). An open one is always listed,
|
|
137
149
|
* however old, and so is one pinned; a saved one not updated `since` is archived (a ta serve of before lists
|
|
138
150
|
* them with the others), or not updated since what `sooner` says of it (ChatIconUtil.archiveSince).
|
|
139
151
|
*/
|
|
140
|
-
function entries(sessions: TaSessionInfo[], saved: TaSavedSessionInfo[], removed: string[], archived?: TaSavedSessionInfo[], since?: number, pinned?: readonly string[], sooner?: (session: TaSavedSessionInfo) => number | undefined,
|
|
152
|
+
function entries(sessions: TaSessionInfo[], saved: TaSavedSessionInfo[], removed: string[], archived?: TaSavedSessionInfo[], since?: number, pinned?: readonly string[], sooner?: (session: TaSavedSessionInfo) => number | undefined, listed?: (session: TaSavedSessionInfo) => unknown): {
|
|
141
153
|
listed: ChatEntry[];
|
|
142
154
|
archived: ChatEntry[];
|
|
143
155
|
removed: ChatEntry[];
|
|
@@ -2,6 +2,7 @@ import { TA_CHAT_PINNED, TaLocation } from '@celljs/ta-protocol';
|
|
|
2
2
|
import { StateUtil } from '../state/state-protocol.js';
|
|
3
3
|
import { MessageUtil } from '../util/message.js';
|
|
4
4
|
import { ChatAskUtil } from './chat-asks.js';
|
|
5
|
+
import { ChatSeenUtil } from './chat-seen.js';
|
|
5
6
|
import { PresenceUtil } from './people.js';
|
|
6
7
|
import { SecretTextUtil } from './secret-text.js';
|
|
7
8
|
/** The list by directory or package, else by day; in any browser. */
|
|
@@ -177,19 +178,40 @@ export var ChatListUtil;
|
|
|
177
178
|
return { pinned: rows.filter(row => keys.has(pinKey(row))), rest: rows.filter(row => !keys.has(pinKey(row))) };
|
|
178
179
|
}
|
|
179
180
|
ChatListUtil.pinnedApart = pinnedApart;
|
|
181
|
+
/**
|
|
182
|
+
* Whether a row said something the user has not seen (ChatSeenUtil.unseen): a saved one answers no more, and what
|
|
183
|
+
* a partner's conversation said till it was seen elsewhere (PartnersUtil.sessions) is seen.
|
|
184
|
+
*/
|
|
185
|
+
function unseen(session, seen, shown, partnerSessions) {
|
|
186
|
+
const at = file(session);
|
|
187
|
+
return ChatSeenUtil.unseen({ ...session, isStreaming: isOpen(session) && session.isStreaming }, at, seen, shown, partnerSessions === null || partnerSessions === void 0 ? void 0 : partnerSessions.get(at));
|
|
188
|
+
}
|
|
189
|
+
ChatListUtil.unseen = unseen;
|
|
190
|
+
/**
|
|
191
|
+
* Which saved conversations of a package's group the list has (`entries`): those that fold into a folder of the
|
|
192
|
+
* list (WebChatIcon.folder), and those of partners (an agent's, PartnersUtil.sessions), the double's list having
|
|
193
|
+
* every conversation with a partner. ta serve opens either again with its group and role, from its file.
|
|
194
|
+
*/
|
|
195
|
+
function groupListed(folderOf, partnerSessions) {
|
|
196
|
+
if (!folderOf && !(partnerSessions === null || partnerSessions === void 0 ? void 0 : partnerSessions.size)) {
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
return session => !!(folderOf === null || folderOf === void 0 ? void 0 : folderOf(session)) || !!(partnerSessions === null || partnerSessions === void 0 ? void 0 : partnerSessions.has(session.sessionFile));
|
|
200
|
+
}
|
|
201
|
+
ChatListUtil.groupListed = groupListed;
|
|
180
202
|
/**
|
|
181
203
|
* The open sessions and the saved ones, those archived and those taken out apart. A saved conversation of a
|
|
182
|
-
* package's group is not listed: its package opens it again, with its role; unless
|
|
183
|
-
*
|
|
204
|
+
* package's group is not listed: its package opens it again, with its role; unless `listed` has it (groupListed:
|
|
205
|
+
* one that folds into a folder of the list, a partner's). An open one is always listed,
|
|
184
206
|
* however old, and so is one pinned; a saved one not updated `since` is archived (a ta serve of before lists
|
|
185
207
|
* them with the others), or not updated since what `sooner` says of it (ChatIconUtil.archiveSince).
|
|
186
208
|
*/
|
|
187
|
-
function entries(sessions, saved, removed, archived = [], since, pinned = [], sooner,
|
|
209
|
+
function entries(sessions, saved, removed, archived = [], since, pinned = [], sooner, listed) {
|
|
188
210
|
const open = new Set(sessions.map(session => session.sessionFile));
|
|
189
211
|
const out = new Set(removed);
|
|
190
212
|
const seen = new Set();
|
|
191
213
|
const closed = [...saved, ...archived].filter(session => {
|
|
192
|
-
if ((session.group && !(
|
|
214
|
+
if ((session.group && !(listed === null || listed === void 0 ? void 0 : listed(session))) || open.has(session.sessionFile) || seen.has(session.sessionFile)) {
|
|
193
215
|
return false;
|
|
194
216
|
}
|
|
195
217
|
seen.add(session.sessionFile);
|
|
@@ -17,7 +17,6 @@ import { ChatIconTile, ChatIconUtil } from './chat-icon.js';
|
|
|
17
17
|
import { useMinute, useOfferPins, usePageEnd, useReadArchive } from './chat-list-hooks.js';
|
|
18
18
|
import { ChatFolderItem, ChatItem } from './chat-list-row.js';
|
|
19
19
|
import { CHAT_PAGE, ChatListUtil } from './chat-list-util.js';
|
|
20
|
-
import { ChatSeenUtil } from './chat-seen.js';
|
|
21
20
|
import { EmptyState } from './empty-state.js';
|
|
22
21
|
import { HostTag } from './host-tag.js';
|
|
23
22
|
import { Icon, IconButton } from './icon.js';
|
|
@@ -104,9 +103,11 @@ export function ChatList({ sessions, saved, removed: removedFiles, archived: arc
|
|
|
104
103
|
const sooner = React.useMemo(() => ChatIconUtil.archiveSince(icons.entries, now), [icons, now]);
|
|
105
104
|
// Those an extension folds into a row of their folder (WebChatIcon.folder), asked again as its icons change.
|
|
106
105
|
const folderOf = React.useMemo(() => ChatIconUtil.folderOf(icons.entries), [icons]);
|
|
106
|
+
const partnerSessions = home === null || home === void 0 ? void 0 : home.partnerSessions; // The agents' conversations, listed once closed too.
|
|
107
|
+
const groupListed = React.useMemo(() => ChatListUtil.groupListed(folderOf, partnerSessions), [folderOf, partnerSessions]);
|
|
107
108
|
// One that waits for the user is not archived, however old, as one pinned.
|
|
108
109
|
const kept = React.useMemo(() => ChatListUtil.keptFiles([...saved, ...(archivedSaved !== null && archivedSaved !== void 0 ? archivedSaved : [])], pinned, letGo), [saved, archivedSaved, pinned, letGo]);
|
|
109
|
-
const { listed, archived, removed } = React.useMemo(() => ChatListUtil.entries(sessions, saved, removedFiles, archivedSaved, since, kept, sooner,
|
|
110
|
+
const { listed, archived, removed } = React.useMemo(() => ChatListUtil.entries(sessions, saved, removedFiles, archivedSaved, since, kept, sooner, groupListed), [sessions, saved, removedFiles, archivedSaved, since, kept, sooner, groupListed]);
|
|
110
111
|
// A folder pinned holds its archived conversations too, and stays once they all are: a row pinned never goes away.
|
|
111
112
|
const { held, rest: archivedRest } = React.useMemo(() => ChatListUtil.heldByPinned(archived, folderOf, pinned), [archived, folderOf, pinned]);
|
|
112
113
|
const sources = React.useMemo(() => ChatListUtil.sources(listed), [listed]);
|
|
@@ -163,7 +164,7 @@ export function ChatList({ sessions, saved, removed: removedFiles, archived: arc
|
|
|
163
164
|
const fold = (key) => onFolded(folded.includes(key) ? folded.filter(other => other !== key) : [...folded, key]);
|
|
164
165
|
const byKey = React.useMemo(() => new Map([...sources, ...ChatListUtil.sources([...archived, ...removed])].map(candidate => [candidate.key, candidate])), [sources, archived, removed]);
|
|
165
166
|
const isSelected = (session) => (typeof session === 'string' ? session : ChatListUtil.key(session)) === selected;
|
|
166
|
-
const isUnseen = (session) =>
|
|
167
|
+
const isUnseen = (session) => ChatListUtil.unseen(session, seen, inFront, partnerSessions);
|
|
167
168
|
// What is folded or not drawn yet still has the conversation shown, and those unseen: the dot of the tab finds them.
|
|
168
169
|
const stays = (session) => isSelected(session) || isUnseen(session);
|
|
169
170
|
const taskUnseen = (task) => ChatHomeUtil.unseen(task, seen);
|
|
@@ -21,13 +21,14 @@ export declare namespace ChatSeenUtil {
|
|
|
21
21
|
function merge(a: ChatSeen, b: ChatSeen): ChatSeen;
|
|
22
22
|
/**
|
|
23
23
|
* Whether it said something the user has not seen: it is not answering now, not the one in front, and its
|
|
24
|
-
* last message came after the user last saw it at rest (or, never seen, after `since`)
|
|
24
|
+
* last message came after the user last saw it at rest (or, never seen, after `since`), and after `seenElsewhere`
|
|
25
|
+
* (an agent's answers read in a group chat, WebPartnerChat.seenAt).
|
|
25
26
|
*/
|
|
26
27
|
function unseen(entry: {
|
|
27
28
|
updatedAt: number;
|
|
28
29
|
messageCount: number;
|
|
29
30
|
isStreaming?: boolean;
|
|
30
|
-
}, file: string, seen: ChatSeen, shown?: string): boolean;
|
|
31
|
+
}, file: string, seen: ChatSeen, shown?: string, seenElsewhere?: number): boolean;
|
|
31
32
|
/**
|
|
32
33
|
* Whether any of the conversations the list shows (ChatListUtil.entries, those listed) said something unseen:
|
|
33
34
|
* the dot on the tab of the chats. Only those: one the list leaves out (a package's, closed) has no row to find.
|
|
@@ -38,7 +39,7 @@ export declare namespace ChatSeenUtil {
|
|
|
38
39
|
isStreaming?: boolean;
|
|
39
40
|
sessionFile?: string;
|
|
40
41
|
sessionId?: string;
|
|
41
|
-
}[], seen: ChatSeen, shown?: string): boolean;
|
|
42
|
+
}[], seen: ChatSeen, shown?: string, elsewhere?: ReadonlyMap<string, number>): boolean;
|
|
42
43
|
/**
|
|
43
44
|
* Everything seen at once, as the user drags the dot of the tab away: kept since the latest of now and of what
|
|
44
45
|
* the conversations said last (the clocks of the page and the computer may differ). One answering goes on, and
|
|
@@ -70,26 +70,27 @@ export var ChatSeenUtil;
|
|
|
70
70
|
ChatSeenUtil.merge = merge;
|
|
71
71
|
/**
|
|
72
72
|
* Whether it said something the user has not seen: it is not answering now, not the one in front, and its
|
|
73
|
-
* last message came after the user last saw it at rest (or, never seen, after `since`)
|
|
73
|
+
* last message came after the user last saw it at rest (or, never seen, after `since`), and after `seenElsewhere`
|
|
74
|
+
* (an agent's answers read in a group chat, WebPartnerChat.seenAt).
|
|
74
75
|
*/
|
|
75
|
-
function unseen(entry, file, seen, shown) {
|
|
76
|
+
function unseen(entry, file, seen, shown, seenElsewhere = 0) {
|
|
76
77
|
var _a;
|
|
77
78
|
return (seen.since > 0 &&
|
|
78
79
|
file !== shown &&
|
|
79
80
|
!entry.isStreaming &&
|
|
80
81
|
entry.messageCount > 0 &&
|
|
81
|
-
(entry.updatedAt > ((_a = seen.at[file]) !== null && _a !== void 0 ? _a : seen.since) || marked(seen, file)));
|
|
82
|
+
(entry.updatedAt > Math.max((_a = seen.at[file]) !== null && _a !== void 0 ? _a : seen.since, seenElsewhere) || marked(seen, file)));
|
|
82
83
|
}
|
|
83
84
|
ChatSeenUtil.unseen = unseen;
|
|
84
85
|
/**
|
|
85
86
|
* Whether any of the conversations the list shows (ChatListUtil.entries, those listed) said something unseen:
|
|
86
87
|
* the dot on the tab of the chats. Only those: one the list leaves out (a package's, closed) has no row to find.
|
|
87
88
|
*/
|
|
88
|
-
function anyUnseen(entries, seen, shown) {
|
|
89
|
+
function anyUnseen(entries, seen, shown, elsewhere) {
|
|
89
90
|
return entries.some(entry => {
|
|
90
91
|
var _a, _b;
|
|
91
92
|
const file = (_b = (_a = entry.sessionFile) !== null && _a !== void 0 ? _a : entry.sessionId) !== null && _b !== void 0 ? _b : '';
|
|
92
|
-
return !!file && unseen(entry, file, seen, shown);
|
|
93
|
+
return !!file && unseen(entry, file, seen, shown, elsewhere === null || elsewhere === void 0 ? void 0 : elsewhere.get(file));
|
|
93
94
|
});
|
|
94
95
|
}
|
|
95
96
|
ChatSeenUtil.anyUnseen = anyUnseen;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { TaSavedSessionInfo, TaSessionInfo } from '@celljs/ta-protocol';
|
|
2
|
+
import type { TaWebExtensions, WebExtensionsState } from '../extension/web-extension-protocol.js';
|
|
3
|
+
import type { LetGoAsks } from './chat-asks.js';
|
|
4
|
+
import { type ChatEntry } from './chat-list-util.js';
|
|
5
|
+
import { type ChatSeen } from './chat-seen.js';
|
|
6
|
+
/** What the dot of the chats reads of the page. */
|
|
7
|
+
export interface ChatsDotInput {
|
|
8
|
+
sessions: readonly TaSessionInfo[];
|
|
9
|
+
saved: readonly TaSavedSessionInfo[];
|
|
10
|
+
removed: string[];
|
|
11
|
+
pinned: readonly string[];
|
|
12
|
+
letGo: LetGoAsks;
|
|
13
|
+
archiveDays: number;
|
|
14
|
+
seen: ChatSeen;
|
|
15
|
+
/** The conversation in front of the user, by its session id. */
|
|
16
|
+
looking?: string;
|
|
17
|
+
extensions: WebExtensionsState;
|
|
18
|
+
host: TaWebExtensions;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The amber dot of the chats' tab and of the double's entry on the rail, on while a row of the double's list has one,
|
|
22
|
+
* as a messenger's: a conversation it lists (those folded into a folder and the agents' too, but those quiet: a call),
|
|
23
|
+
* and, where the list is the double's, a row of its home, a conversation with a partner that is none of pi (a group
|
|
24
|
+
* chat, a chat of two) and a task that is no conversation. `listed`: the conversations it lists, which dragging the dot
|
|
25
|
+
* away sees; a row of the home or a partner's keeps its dot till it is opened, as on its row.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useChatsDot(input: ChatsDotInput): {
|
|
28
|
+
listed: ChatEntry[];
|
|
29
|
+
unseen: boolean;
|
|
30
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PartnersUtil } from '../partners/partners-util.js';
|
|
3
|
+
import { WorkbenchUtil } from '../workbench-util.js';
|
|
4
|
+
import { ChatHomeUtil } from './chat-home-util.js';
|
|
5
|
+
import { ChatIconUtil } from './chat-icon.js';
|
|
6
|
+
import { ChatListUtil } from './chat-list-util.js';
|
|
7
|
+
import { ChatSeenUtil } from './chat-seen.js';
|
|
8
|
+
import { SideListUtil } from './side-lists.js';
|
|
9
|
+
/**
|
|
10
|
+
* The amber dot of the chats' tab and of the double's entry on the rail, on while a row of the double's list has one,
|
|
11
|
+
* as a messenger's: a conversation it lists (those folded into a folder and the agents' too, but those quiet: a call),
|
|
12
|
+
* and, where the list is the double's, a row of its home, a conversation with a partner that is none of pi (a group
|
|
13
|
+
* chat, a chat of two) and a task that is no conversation. `listed`: the conversations it lists, which dragging the dot
|
|
14
|
+
* away sees; a row of the home or a partner's keeps its dot till it is opened, as on its row.
|
|
15
|
+
*/
|
|
16
|
+
export function useChatsDot(input) {
|
|
17
|
+
const { sessions, saved, removed, pinned, letGo, archiveDays, seen, looking, extensions, host } = input;
|
|
18
|
+
const tasks = React.useSyncExternalStore(host.tasks.subscribe, host.tasks.tasks, host.tasks.tasks);
|
|
19
|
+
const items = React.useSyncExternalStore(host.home.subscribe, host.home.items, host.home.items);
|
|
20
|
+
const partners = React.useSyncExternalStore(host.partners.subscribe, host.partners.partners, host.partners.partners);
|
|
21
|
+
const doubleList = !SideListUtil.viewListsDouble(extensions.views);
|
|
22
|
+
const partnerSessions = React.useMemo(() => (doubleList ? PartnersUtil.sessions(partners) : undefined), [doubleList, partners]);
|
|
23
|
+
const icons = extensions.chatIcons;
|
|
24
|
+
const listed = React.useMemo(() => {
|
|
25
|
+
const now = Date.now();
|
|
26
|
+
return ChatListUtil.entries([...sessions], [...saved], removed, undefined, WorkbenchUtil.daysAgo(now, archiveDays), ChatListUtil.keptFiles(saved, pinned, letGo), ChatIconUtil.archiveSince(icons, now), ChatListUtil.groupListed(ChatIconUtil.folderOf(icons), partnerSessions)).listed;
|
|
27
|
+
}, [sessions, saved, removed, archiveDays, pinned, letGo, icons, partnerSessions]);
|
|
28
|
+
const inFront = looking ? sessions.find(session => session.sessionId === looking) : undefined;
|
|
29
|
+
const said = ChatSeenUtil.anyUnseen(ChatIconUtil.loud(icons, listed), seen, inFront && ChatListUtil.file(inFront), partnerSessions);
|
|
30
|
+
return { listed, unseen: said || (doubleList && ChatHomeUtil.anyUnseen(items, partners, tasks, seen)) };
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=chats-dot.js.map
|