@celljs/ta-web 4.46.2 → 4.47.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/account/account-side.d.ts +3 -3
- package/esm/browser/account/account-side.js +11 -21
- package/esm/browser/account/device-account.d.ts +8 -0
- package/esm/browser/account/device-account.js +20 -0
- package/esm/browser/chat/chat-protocol.d.ts +7 -0
- package/esm/browser/chat/chat-view.js +1 -1
- package/esm/browser/chat/chat.d.ts +1 -0
- package/esm/browser/chat/chat.js +15 -3
- package/esm/browser/chat/draft-model.d.ts +1 -1
- package/esm/browser/chat/draft-model.js +2 -2
- package/esm/browser/components/access-view.js +12 -10
- package/esm/browser/components/account-menu.d.ts +2 -0
- package/esm/browser/components/account-menu.js +11 -2
- package/esm/browser/components/account-view.js +9 -5
- package/esm/browser/components/app-nav.js +4 -1
- package/esm/browser/components/app-shell-state.d.ts +2 -0
- package/esm/browser/components/app-update-view.d.ts +2 -0
- package/esm/browser/components/app-update-view.js +37 -0
- package/esm/browser/components/app-view.js +33 -108
- package/esm/browser/components/auth-guide.d.ts +25 -0
- package/esm/browser/components/auth-guide.js +44 -0
- package/esm/browser/components/auth-view.d.ts +2 -0
- package/esm/browser/components/auth-view.js +30 -9
- package/esm/browser/components/chat-list-controls.d.ts +38 -0
- package/esm/browser/components/chat-list-controls.js +46 -0
- package/esm/browser/components/chat-list-hooks.d.ts +19 -0
- package/esm/browser/components/chat-list-hooks.js +52 -0
- package/esm/browser/components/chat-list-rows.d.ts +51 -0
- package/esm/browser/components/chat-list-rows.js +110 -0
- package/esm/browser/components/chat-list-sections.d.ts +36 -0
- package/esm/browser/components/chat-list-sections.js +72 -0
- package/esm/browser/components/chat-list.js +48 -221
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/cloud-sign-in-view.js +4 -1
- package/esm/browser/components/custom-provider-util.d.ts +2 -0
- package/esm/browser/components/custom-provider-util.js +5 -0
- package/esm/browser/components/custom-provider-view.js +33 -12
- package/esm/browser/components/device-sign-in-page.js +4 -5
- package/esm/browser/components/discover-view.d.ts +8 -1
- package/esm/browser/components/discover-view.js +28 -3
- package/esm/browser/components/environment-view.js +60 -62
- package/esm/browser/components/extension-settings.js +1 -0
- package/esm/browser/components/first-steps-util.d.ts +29 -0
- package/esm/browser/components/first-steps-util.js +41 -0
- package/esm/browser/components/first-steps.d.ts +3 -0
- package/esm/browser/components/first-steps.js +36 -0
- package/esm/browser/components/host-view.d.ts +3 -3
- package/esm/browser/components/host-view.js +11 -11
- package/esm/browser/components/me-rows.d.ts +8 -1
- package/esm/browser/components/me-rows.js +3 -3
- package/esm/browser/components/me-view.js +1 -1
- package/esm/browser/components/message-user.js +6 -3
- package/esm/browser/components/model-picker.d.ts +5 -0
- package/esm/browser/components/model-picker.js +10 -1
- package/esm/browser/components/nav-places.d.ts +14 -0
- package/esm/browser/components/nav-places.js +11 -0
- package/esm/browser/components/phone-shell.d.ts +14 -0
- package/esm/browser/components/phone-shell.js +22 -0
- package/esm/browser/components/picture-dialog.js +4 -7
- package/esm/browser/components/profile-view.js +1 -1
- package/esm/browser/components/relay-services.js +4 -7
- package/esm/browser/components/relay-view-util.d.ts +5 -0
- package/esm/browser/components/relay-view-util.js +14 -0
- package/esm/browser/components/relay-view.js +40 -37
- package/esm/browser/components/scan-screen.js +5 -8
- package/esm/browser/components/screen-navigator.d.ts +9 -0
- package/esm/browser/components/screen-navigator.js +84 -0
- package/esm/browser/components/search-page.js +9 -2
- package/esm/browser/components/serve-value.d.ts +27 -0
- package/esm/browser/components/serve-value.js +61 -0
- package/esm/browser/components/serve-watch.d.ts +23 -0
- package/esm/browser/components/serve-watch.js +36 -0
- package/esm/browser/components/settings-choices.js +2 -0
- package/esm/browser/components/settings-controls.d.ts +15 -0
- package/esm/browser/components/settings-controls.js +13 -0
- package/esm/browser/components/settings-more.js +6 -4
- package/esm/browser/components/settings-parts.d.ts +3 -1
- package/esm/browser/components/settings-parts.js +3 -0
- package/esm/browser/components/settings-view.js +37 -11
- package/esm/browser/components/share-friends.js +3 -4
- package/esm/browser/components/share-sheet.js +3 -4
- package/esm/browser/components/tool-view.js +17 -3
- package/esm/browser/device/app-update.d.ts +62 -0
- package/esm/browser/device/app-update.js +144 -0
- package/esm/browser/extension/icons.js +2 -1
- package/esm/browser/extension/web-api-contributions.d.ts +6 -1
- package/esm/browser/extension/web-api-partners.d.ts +6 -0
- package/esm/browser/extension/web-api-spec.js +1 -0
- package/esm/browser/extension/web-home.js +9 -0
- package/esm/browser/extension/web-metrics.d.ts +3 -0
- package/esm/browser/extension/web-metrics.js +33 -22
- package/esm/browser/extension/web-pages.d.ts +3 -1
- package/esm/browser/extension/web-pages.js +1 -0
- package/esm/browser/gateway/console-agents.js +11 -15
- package/esm/browser/gateway/console-parts.d.ts +7 -4
- package/esm/browser/gateway/console-parts.js +11 -20
- package/esm/browser/gateway/console-trend.js +2 -2
- package/esm/browser/gateway/console-updates.js +6 -4
- package/esm/browser/gateway/console-view.js +6 -6
- package/esm/browser/i18n/en/account.d.ts +7 -0
- package/esm/browser/i18n/en/account.js +13 -6
- package/esm/browser/i18n/en/chat.d.ts +2 -0
- package/esm/browser/i18n/en/chat.js +2 -0
- package/esm/browser/i18n/en/discover.d.ts +3 -0
- package/esm/browser/i18n/en/discover.js +3 -0
- package/esm/browser/i18n/en/service.d.ts +6 -0
- package/esm/browser/i18n/en/service.js +6 -0
- package/esm/browser/i18n/en/settings.d.ts +3 -0
- package/esm/browser/i18n/en/settings.js +3 -0
- package/esm/browser/i18n/ja/account.js +13 -6
- package/esm/browser/i18n/ja/chat.js +2 -0
- package/esm/browser/i18n/ja/discover.js +3 -0
- package/esm/browser/i18n/ja/service.js +6 -0
- package/esm/browser/i18n/ja/settings.js +3 -0
- package/esm/browser/i18n/locales.d.ts +22 -1
- package/esm/browser/i18n/messages.d.ts +21 -0
- package/esm/browser/i18n/zh/account.js +13 -6
- package/esm/browser/i18n/zh/chat.js +2 -0
- package/esm/browser/i18n/zh/discover.js +3 -0
- package/esm/browser/i18n/zh/service.js +6 -0
- package/esm/browser/i18n/zh/settings.js +3 -0
- package/esm/browser/i18n/zh-tw/account.js +13 -6
- package/esm/browser/i18n/zh-tw/chat.js +2 -0
- package/esm/browser/i18n/zh-tw/discover.js +3 -0
- package/esm/browser/i18n/zh-tw/service.js +6 -0
- package/esm/browser/i18n/zh-tw/settings.js +3 -0
- package/esm/browser/notices/notices.d.ts +2 -0
- package/esm/browser/notices/notices.js +2 -0
- package/esm/browser/partners/group-picker.js +3 -4
- package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/esm/browser/settings/settings-protocol.d.ts +5 -0
- package/esm/browser/settings/settings-protocol.js +2 -0
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +4 -3
- package/esm/browser/style/dialogs.d.ts +1 -1
- package/esm/browser/style/dialogs.js +7 -0
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +5 -3
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +1 -1
- package/esm/browser/util/tool.d.ts +5 -0
- package/esm/browser/util/tool.js +21 -3
- package/lib/browser/account/account-side.d.ts +3 -3
- package/lib/browser/account/account-side.js +11 -21
- package/lib/browser/account/device-account.d.ts +8 -0
- package/lib/browser/account/device-account.js +20 -0
- package/lib/browser/chat/chat-protocol.d.ts +7 -0
- package/lib/browser/chat/chat-view.js +1 -1
- package/lib/browser/chat/chat.d.ts +1 -0
- package/lib/browser/chat/chat.js +14 -2
- package/lib/browser/chat/draft-model.d.ts +1 -1
- package/lib/browser/chat/draft-model.js +2 -2
- package/lib/browser/components/access-view.js +12 -10
- package/lib/browser/components/account-menu.d.ts +2 -0
- package/lib/browser/components/account-menu.js +11 -2
- package/lib/browser/components/account-view.js +9 -5
- package/lib/browser/components/app-nav.js +3 -0
- package/lib/browser/components/app-shell-state.d.ts +2 -0
- package/lib/browser/components/app-update-view.d.ts +3 -0
- package/lib/browser/components/app-update-view.js +73 -0
- package/lib/browser/components/app-view.js +30 -105
- package/lib/browser/components/auth-guide.d.ts +26 -0
- package/lib/browser/components/auth-guide.js +47 -0
- package/lib/browser/components/auth-view.d.ts +2 -0
- package/lib/browser/components/auth-view.js +29 -8
- package/lib/browser/components/chat-list-controls.d.ts +39 -0
- package/lib/browser/components/chat-list-controls.js +86 -0
- package/lib/browser/components/chat-list-hooks.d.ts +19 -0
- package/lib/browser/components/chat-list-hooks.js +53 -0
- package/lib/browser/components/chat-list-rows.d.ts +52 -0
- package/lib/browser/components/chat-list-rows.js +147 -0
- package/lib/browser/components/chat-list-sections.d.ts +37 -0
- package/lib/browser/components/chat-list-sections.js +108 -0
- package/lib/browser/components/chat-list.js +44 -217
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/cloud-sign-in-view.js +4 -1
- package/lib/browser/components/custom-provider-util.d.ts +2 -0
- package/lib/browser/components/custom-provider-util.js +5 -0
- package/lib/browser/components/custom-provider-view.js +32 -11
- package/lib/browser/components/device-sign-in-page.js +4 -5
- package/lib/browser/components/discover-view.d.ts +8 -1
- package/lib/browser/components/discover-view.js +27 -2
- package/lib/browser/components/environment-view.js +60 -62
- package/lib/browser/components/extension-settings.js +1 -0
- package/lib/browser/components/first-steps-util.d.ts +30 -0
- package/lib/browser/components/first-steps-util.js +44 -0
- package/lib/browser/components/first-steps.d.ts +4 -0
- package/lib/browser/components/first-steps.js +72 -0
- package/lib/browser/components/host-view.d.ts +3 -3
- package/lib/browser/components/host-view.js +11 -11
- package/lib/browser/components/me-rows.d.ts +8 -1
- package/lib/browser/components/me-rows.js +3 -3
- package/lib/browser/components/me-view.js +1 -1
- package/lib/browser/components/message-user.js +5 -2
- package/lib/browser/components/model-picker.d.ts +5 -0
- package/lib/browser/components/model-picker.js +10 -1
- package/lib/browser/components/nav-places.d.ts +14 -0
- package/lib/browser/components/nav-places.js +13 -1
- package/lib/browser/components/phone-shell.d.ts +14 -0
- package/lib/browser/components/phone-shell.js +23 -0
- package/lib/browser/components/picture-dialog.js +4 -7
- package/lib/browser/components/profile-view.js +1 -1
- package/lib/browser/components/relay-services.js +4 -7
- package/lib/browser/components/relay-view-util.d.ts +6 -0
- package/lib/browser/components/relay-view-util.js +17 -0
- package/lib/browser/components/relay-view.js +38 -35
- package/lib/browser/components/scan-screen.js +5 -8
- package/lib/browser/components/screen-navigator.d.ts +9 -0
- package/lib/browser/components/screen-navigator.js +85 -0
- package/lib/browser/components/search-page.js +8 -1
- package/lib/browser/components/serve-value.d.ts +28 -0
- package/lib/browser/components/serve-value.js +97 -0
- package/lib/browser/components/serve-watch.d.ts +24 -0
- package/lib/browser/components/serve-watch.js +39 -0
- package/lib/browser/components/settings-choices.js +2 -0
- package/lib/browser/components/settings-controls.d.ts +15 -0
- package/lib/browser/components/settings-controls.js +13 -0
- package/lib/browser/components/settings-more.js +6 -4
- package/lib/browser/components/settings-parts.d.ts +3 -1
- package/lib/browser/components/settings-parts.js +3 -0
- package/lib/browser/components/settings-view.js +36 -10
- package/lib/browser/components/share-friends.js +3 -4
- package/lib/browser/components/share-sheet.js +3 -4
- package/lib/browser/components/tool-view.js +17 -3
- package/lib/browser/device/app-update.d.ts +63 -0
- package/lib/browser/device/app-update.js +182 -0
- package/lib/browser/extension/icons.js +1 -0
- package/lib/browser/extension/web-api-contributions.d.ts +6 -1
- package/lib/browser/extension/web-api-partners.d.ts +6 -0
- package/lib/browser/extension/web-api-spec.js +1 -0
- package/lib/browser/extension/web-home.js +9 -0
- package/lib/browser/extension/web-metrics.d.ts +3 -0
- package/lib/browser/extension/web-metrics.js +32 -21
- package/lib/browser/extension/web-pages.d.ts +3 -1
- package/lib/browser/extension/web-pages.js +1 -0
- package/lib/browser/gateway/console-agents.js +10 -14
- package/lib/browser/gateway/console-parts.d.ts +7 -4
- package/lib/browser/gateway/console-parts.js +12 -21
- package/lib/browser/gateway/console-trend.js +1 -1
- package/lib/browser/gateway/console-updates.js +5 -3
- package/lib/browser/gateway/console-view.js +5 -5
- package/lib/browser/i18n/en/account.d.ts +7 -0
- package/lib/browser/i18n/en/account.js +13 -6
- package/lib/browser/i18n/en/chat.d.ts +2 -0
- package/lib/browser/i18n/en/chat.js +2 -0
- package/lib/browser/i18n/en/discover.d.ts +3 -0
- package/lib/browser/i18n/en/discover.js +3 -0
- package/lib/browser/i18n/en/service.d.ts +6 -0
- package/lib/browser/i18n/en/service.js +6 -0
- package/lib/browser/i18n/en/settings.d.ts +3 -0
- package/lib/browser/i18n/en/settings.js +3 -0
- package/lib/browser/i18n/ja/account.js +13 -6
- package/lib/browser/i18n/ja/chat.js +2 -0
- package/lib/browser/i18n/ja/discover.js +3 -0
- package/lib/browser/i18n/ja/service.js +6 -0
- package/lib/browser/i18n/ja/settings.js +3 -0
- package/lib/browser/i18n/locales.d.ts +22 -1
- package/lib/browser/i18n/messages.d.ts +21 -0
- package/lib/browser/i18n/zh/account.js +13 -6
- package/lib/browser/i18n/zh/chat.js +2 -0
- package/lib/browser/i18n/zh/discover.js +3 -0
- package/lib/browser/i18n/zh/service.js +6 -0
- package/lib/browser/i18n/zh/settings.js +3 -0
- package/lib/browser/i18n/zh-tw/account.js +13 -6
- package/lib/browser/i18n/zh-tw/chat.js +2 -0
- package/lib/browser/i18n/zh-tw/discover.js +3 -0
- package/lib/browser/i18n/zh-tw/service.js +6 -0
- package/lib/browser/i18n/zh-tw/settings.js +3 -0
- package/lib/browser/notices/notices.d.ts +2 -0
- package/lib/browser/notices/notices.js +3 -1
- package/lib/browser/partners/group-picker.js +3 -4
- package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/lib/browser/settings/settings-protocol.d.ts +5 -0
- package/lib/browser/settings/settings-protocol.js +2 -0
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +4 -3
- package/lib/browser/style/dialogs.d.ts +1 -1
- package/lib/browser/style/dialogs.js +7 -0
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +5 -3
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +1 -1
- package/lib/browser/util/tool.d.ts +5 -0
- package/lib/browser/util/tool.js +21 -3
- package/package.json +7 -7
|
@@ -2,14 +2,14 @@ import { ChevronLeft } from 'lucide-react';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { AssistantChatList } from '../assistant/assistant-chat-list.js';
|
|
4
4
|
import { ChatView } from '../chat/chat-view.js';
|
|
5
|
-
import {
|
|
6
|
-
import { WebCwdUtil, WebLabelUtil } from '../extension/web-extension-protocol.js';
|
|
5
|
+
import { WebCwdUtil } from '../extension/web-extension-protocol.js';
|
|
7
6
|
import { usePersisted } from '../hooks.js';
|
|
8
|
-
import { SIGN_IN_EVENT } from '../notices/notices.js';
|
|
7
|
+
import { SIGN_IN_EVENT, SIGNED_IN_EVENT } from '../notices/notices.js';
|
|
9
8
|
import { AppContexts } from './app-contexts.js';
|
|
10
9
|
import { PageView, Rail, SidebarView } from './app-nav.js';
|
|
11
10
|
import { LOGIN_LATER, RAIL } from './app-shell-hooks.js';
|
|
12
11
|
import { useAppShell } from './app-shell-state.js';
|
|
12
|
+
import { AppUpdateNotices } from './app-update-view.js';
|
|
13
13
|
import { AuthUtil, LoginPage, useAuthProviders } from './auth-view.js';
|
|
14
14
|
import { BoardSurface } from './board.js';
|
|
15
15
|
import { ChatAskUtil } from './chat-asks.js';
|
|
@@ -22,6 +22,7 @@ import { DiscoverView } from './discover-view.js';
|
|
|
22
22
|
import { EditorArea } from './editor-area.js';
|
|
23
23
|
import { EntryHoldUtil, useCallGoingOn } from './entry-holds.js';
|
|
24
24
|
import { EnvironmentPage } from './environment-view.js';
|
|
25
|
+
import { useFirstSteps } from './first-steps.js';
|
|
25
26
|
import { DeviceOverlays } from './host-view.js';
|
|
26
27
|
import { IconButton, SidebarLeft } from './icon.js';
|
|
27
28
|
import { KeptCallBar } from './kept-call-bar.js';
|
|
@@ -31,11 +32,10 @@ import { LinkDialog } from './link-dialog.js';
|
|
|
31
32
|
import { MeView } from './me-view.js';
|
|
32
33
|
import { DISCOVER, ME_TAB, phoneTabs } from './nav-places.js';
|
|
33
34
|
import { NoticeCenter } from './notice-center.js';
|
|
34
|
-
import {
|
|
35
|
+
import { PhoneHome, PhoneShell } from './phone-shell.js';
|
|
35
36
|
import { RemotePrompts } from './remote-prompts.js';
|
|
36
37
|
import { ScanHost } from './scan-screen.js';
|
|
37
|
-
import { useScreenNavigator } from './screen-navigator.js';
|
|
38
|
-
import { ScreenNavigatorUtil } from './screen-navigator-util.js';
|
|
38
|
+
import { shellPlaces, useScreenNavigator } from './screen-navigator.js';
|
|
39
39
|
import { ServeRestartNotices } from './serve-restart.js';
|
|
40
40
|
import { SettingsView } from './settings-view.js';
|
|
41
41
|
import { ShareHost } from './share-dialog.js';
|
|
@@ -52,9 +52,10 @@ import { SignIn } from './workbench-view.js';
|
|
|
52
52
|
* the conversation instead.
|
|
53
53
|
*/
|
|
54
54
|
export function AppShell() {
|
|
55
|
-
var _a, _b
|
|
56
|
-
var
|
|
57
|
-
const
|
|
55
|
+
var _a, _b;
|
|
56
|
+
var _c, _d;
|
|
57
|
+
const shell = useAppShell();
|
|
58
|
+
const { t, workbench, extensions, host, store, pending, chat, setSideId, removedChats, chatsByDirectory, setChatsByDirectory, foldedChats, setFoldedChats, pinnedChats, setPinnedChats, letGoAsks, setLetGoAsks, navOpen, setNavOpen, phone, screenOpen, setScreenOpen, surface, setSurface, surfaces, settings, setSettings, settingsOpened, tabPage, setTabPage, openSettings, closeSettings, settingsShown, toggleRight, maximized, setMaximized, chatSettings, readArchived, sidebar, editor, online, fileUrl, openLink, activeEditor, view, sideView, side, showPage, lists, tools, openTool, editors, showEditors, navigation, codeScan, notices, railCurrent, tabView, screenPage, seenChats, looking, state, sideShown, showList, toggleWorkbench, toggleSides, picking, chatsBusy, setChatsBusy, deciding, } = shell;
|
|
58
59
|
const [providers, reloadProviders] = useAuthProviders(online);
|
|
59
60
|
const [later, setLater] = usePersisted(LOGIN_LATER);
|
|
60
61
|
/** A call failed for want of a sign-in (SIGN_IN_EVENT): the page of sign-in, even if the user put it off. */
|
|
@@ -67,12 +68,27 @@ export function AppShell() {
|
|
|
67
68
|
window.addEventListener(SIGN_IN_EVENT, ask);
|
|
68
69
|
return () => window.removeEventListener(SIGN_IN_EVENT, ask);
|
|
69
70
|
}, [reloadProviders]);
|
|
71
|
+
// Models now where there were none (a key, an account, an agent installed meanwhile): the page of sign-in is done
|
|
72
|
+
// with, and what failed for want of one goes (TaChat.resendSignedOut).
|
|
73
|
+
const signedIn = providers && AuthUtil.signedIn(providers);
|
|
74
|
+
const hadModels = React.useRef(undefined);
|
|
75
|
+
React.useEffect(() => {
|
|
76
|
+
if (signedIn === undefined) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (signedIn && hadModels.current === false) {
|
|
80
|
+
setAsked(false);
|
|
81
|
+
window.dispatchEvent(new Event(SIGNED_IN_EVENT));
|
|
82
|
+
}
|
|
83
|
+
hadModels.current = signedIn;
|
|
84
|
+
}, [signedIn]);
|
|
70
85
|
const doubleId = DOUBLE_PAGE;
|
|
71
86
|
// Where Ta's agents read the page to be, and go (docs/design/ta-app-use.md 3): set below as it renders.
|
|
72
87
|
const screenShell = useScreenNavigator();
|
|
73
88
|
const inCall = useCallGoingOn();
|
|
74
89
|
// 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
|
|
75
90
|
// messenger's; what waits for the user to decide is counted there until answered.
|
|
91
|
+
useFirstSteps(workbench.status === 'online', workbench.sessions, workbench.saved);
|
|
76
92
|
const { listed: listedChats, unseen: chatsUnseen } = useChatsDot({
|
|
77
93
|
sessions: workbench.sessions,
|
|
78
94
|
saved: workbench.saved,
|
|
@@ -98,6 +114,8 @@ export function AppShell() {
|
|
|
98
114
|
}, onSignedIn: () => {
|
|
99
115
|
setAsked(false);
|
|
100
116
|
reloadProviders();
|
|
117
|
+
// What failed for want of a model goes now (TaChat.resendSignedOut).
|
|
118
|
+
window.dispatchEvent(new Event(SIGNED_IN_EVENT));
|
|
101
119
|
}, onProviders: reloadProviders }));
|
|
102
120
|
}
|
|
103
121
|
// What the columns beside the conversation and the editors take, so that the editors never take more than the conversation.
|
|
@@ -132,7 +150,7 @@ export function AppShell() {
|
|
|
132
150
|
}, onPicked: picked, busy: busy, onBusy: setChatsBusy }));
|
|
133
151
|
// On a phone the conversations going on are pushed over the tab (below); elsewhere they are the chats, filtered.
|
|
134
152
|
const sideList = sideView ? React.createElement(SidebarView, { view: sideView }) : chatList(!phone && chatsBusy);
|
|
135
|
-
const editorArea = (React.createElement(EditorArea, { editors: extensions.editors, active: activeEditor, views: tools, onShow: id => host.showEditor(id), onClose: ids => void host.closeEditors(ids), onPin: id => host.pinEditor(id), onOpenView: openTool, onHide: editor.toggle, cwd: (
|
|
153
|
+
const editorArea = (React.createElement(EditorArea, { editors: extensions.editors, active: activeEditor, views: tools, onShow: id => host.showEditor(id), onClose: ids => void host.closeEditors(ids), onPin: id => host.pinEditor(id), onOpenView: openTool, onHide: editor.toggle, cwd: (_c = WebCwdUtil.shown(extensions)) !== null && _c !== void 0 ? _c : (_a = workbench.server) === null || _a === void 0 ? void 0 : _a.cwd, maximized: maximized, onMaximize: () => setMaximized(!maximized) }));
|
|
136
154
|
// A photo of the scan screen to the double: its conversation shows, the photo goes with what to do with it.
|
|
137
155
|
const askDouble = async (text, image) => {
|
|
138
156
|
const double = extensions.views.find(candidate => candidate.id === DOUBLE_PAGE);
|
|
@@ -153,6 +171,7 @@ export function AppShell() {
|
|
|
153
171
|
React.createElement(LinkDialog, null),
|
|
154
172
|
React.createElement(RemotePrompts, null),
|
|
155
173
|
React.createElement(ServeRestartNotices, null),
|
|
174
|
+
React.createElement(AppUpdateNotices, null),
|
|
156
175
|
React.createElement(DeviceOverlays, null),
|
|
157
176
|
codeScan && React.createElement(ScanHost, { onCode: text => void codeScan.open(text), onAsk: askDouble }),
|
|
158
177
|
React.createElement(ShareHost, null),
|
|
@@ -197,7 +216,7 @@ export function AppShell() {
|
|
|
197
216
|
showPage(id);
|
|
198
217
|
}
|
|
199
218
|
};
|
|
200
|
-
const discoverView = (leading) => (React.createElement(DiscoverView, { pages: navigation.discover, onOpenPages: navigation.onOpen, onOpen: openDiscovered, onPin: pinDiscovered, onSettings: () => openSettings('navigation'), onScan: codeScan && (() => void codeScan.scan()), leading: leading }));
|
|
219
|
+
const discoverView = (leading) => (React.createElement(DiscoverView, { pages: navigation.discover, onOpenPages: navigation.onOpen, onOpen: openDiscovered, onPin: pinDiscovered, onSettings: () => openSettings('navigation'), onScan: codeScan && (() => void codeScan.scan()), leading: leading, first: navigation.first, onAllFeatures: navigation.showAll }));
|
|
201
220
|
const keptPages = EntryHoldUtil.kept(extensions.kept, inCall, tabView);
|
|
202
221
|
const holds = EntryHoldUtil.holds({
|
|
203
222
|
double: () => {
|
|
@@ -238,7 +257,7 @@ export function AppShell() {
|
|
|
238
257
|
? { ...item, asks: deciding, onSeeAll: letGoAllAsks }
|
|
239
258
|
: item)
|
|
240
259
|
: [];
|
|
241
|
-
const tab = tabPage === 'me' ? ME_TAB : tabPage === 'discover' ? DISCOVER : ((
|
|
260
|
+
const tab = tabPage === 'me' ? ME_TAB : tabPage === 'discover' ? DISCOVER : ((_d = tabView === null || tabView === void 0 ? void 0 : tabView.id) !== null && _d !== void 0 ? _d : side);
|
|
242
261
|
const pickTab = (id) => {
|
|
243
262
|
setSurface(undefined);
|
|
244
263
|
setChatsBusy(false);
|
|
@@ -254,81 +273,9 @@ export function AppShell() {
|
|
|
254
273
|
setSideId(id);
|
|
255
274
|
}
|
|
256
275
|
};
|
|
257
|
-
|
|
258
|
-
const shownChat = store ? workbench.sessions.find(session => session.sessionId === store.sessionId) : undefined;
|
|
259
|
-
screenShell.current = {
|
|
260
|
-
phone,
|
|
261
|
-
where: ScreenNavigatorUtil.where({
|
|
262
|
-
settings: settingsShown ? (settings !== null && settings !== void 0 ? settings : '') : undefined,
|
|
263
|
-
page: phone ? (screenOpen ? screenPage : tabView) : tabPage === 'discover' ? undefined : view,
|
|
264
|
-
discover: tabPage === 'discover',
|
|
265
|
-
me: phone && !screenOpen && tabPage === 'me',
|
|
266
|
-
list: (phone ? !screenOpen && !tabView && !tabPage : sideShown) ? (_b = lists.find(entry => entry.id === side)) === null || _b === void 0 ? void 0 : _b.label : undefined,
|
|
267
|
-
chat: (phone ? screenOpen && !screenPage && settings === undefined : settings === undefined && tabPage !== 'discover' && !view)
|
|
268
|
-
? shownChat
|
|
269
|
-
? chatName(shownChat)
|
|
270
|
-
: t('ta.chat.new')
|
|
271
|
-
: undefined,
|
|
272
|
-
words: { settings: t('ta.settings'), discover: t('ta.discover'), me: t('ta.me') },
|
|
273
|
-
}),
|
|
274
|
-
places: [
|
|
275
|
-
...lists.map(entry => ({ id: `list:${entry.id}`, title: entry.label })),
|
|
276
|
-
...navigation.pages.map(page => ({
|
|
277
|
-
id: `page:${page.id}`,
|
|
278
|
-
title: WebLabelUtil.text(page.title),
|
|
279
|
-
})),
|
|
280
|
-
...navigation.onOpen.map(page => ({ id: `page:${page.id}`, title: page.title })),
|
|
281
|
-
{ id: 'discover', title: t('ta.discover') },
|
|
282
|
-
...(phone ? [{ id: 'me', title: t('ta.me') }] : []),
|
|
283
|
-
{ id: 'settings', title: t('ta.settings') },
|
|
284
|
-
],
|
|
285
|
-
goPlace: place => {
|
|
286
|
-
const [kind, id = ''] = place.id.split(/:(.*)/s);
|
|
287
|
-
if (kind === 'settings') {
|
|
288
|
-
return openSettings();
|
|
289
|
-
}
|
|
290
|
-
if (kind === 'page') {
|
|
291
|
-
return host.showView(id);
|
|
292
|
-
}
|
|
293
|
-
if (phone) {
|
|
294
|
-
// The tabs are under the screen of a phone: what is over them slides away, as the back does.
|
|
295
|
-
if (screenOpen) {
|
|
296
|
-
closeScreen();
|
|
297
|
-
}
|
|
298
|
-
return pickTab(kind === 'list' ? id : kind === 'me' ? ME_TAB : DISCOVER);
|
|
299
|
-
}
|
|
300
|
-
setSettings(undefined);
|
|
301
|
-
setNavOpen(false);
|
|
302
|
-
if (kind === 'discover') {
|
|
303
|
-
setTabPage('discover');
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
setTabPage(undefined);
|
|
307
|
-
setSideId(id);
|
|
308
|
-
if (view) {
|
|
309
|
-
host.showPage('');
|
|
310
|
-
}
|
|
311
|
-
sidebar.reveal();
|
|
312
|
-
},
|
|
313
|
-
showChat: async (target) => {
|
|
314
|
-
const switcher = host.sessionSwitcher();
|
|
315
|
-
if (!switcher) {
|
|
316
|
-
throw new Error('The page cannot show a conversation yet.');
|
|
317
|
-
}
|
|
318
|
-
const shown = switcher('sessionId' in target ? target.sessionId : { sessionFile: target.sessionFile });
|
|
319
|
-
host.showPage('');
|
|
320
|
-
await shown;
|
|
321
|
-
},
|
|
322
|
-
chats: [
|
|
323
|
-
...workbench.sessions
|
|
324
|
-
.filter(session => !session.group)
|
|
325
|
-
.map(session => ({ name: chatName(session), sessionId: session.sessionId, sessionFile: session.sessionFile })),
|
|
326
|
-
...workbench.saved.filter(saved => !saved.group).map(saved => ({ name: chatName(saved), sessionFile: saved.sessionFile })),
|
|
327
|
-
],
|
|
328
|
-
openSettings,
|
|
329
|
-
};
|
|
276
|
+
screenShell.current = shellPlaces(shell, { closeScreen, pickTab });
|
|
330
277
|
// The launcher and the board are over the first tab only, as WeChat's over its chats.
|
|
331
|
-
const firstTab = ((
|
|
278
|
+
const firstTab = ((_b = tabs[0]) === null || _b === void 0 ? void 0 : _b.id) === tab;
|
|
332
279
|
const content = phone ? (React.createElement(PhoneShell, { tabs: tabs, tab: tab, launcher: firstTab && surfaces.launcher ? React.createElement(LauncherSurface, { active: surface === 'launcher' }) : undefined, board: firstTab && surfaces.board ? (React.createElement(BoardSurface, { leading: React.createElement(IconButton, { icon: ChevronLeft, label: t('ta.back'), onClick: () => setSurface(undefined) }) })) : undefined, surface: surface, onSurface: setSurface, onTab: pickTab, home: React.createElement(PhoneHome, { pushable: SideListUtil.pushesOver(tabView), busy: chatsBusy, onBusy: setChatsBusy, busyList: () => React.createElement("div", { className: "ta-sidebar" }, chatList(true)) }, tabPage === 'me' ? (React.createElement("div", { className: "ta-main" },
|
|
333
280
|
React.createElement(MeView, { onSettings: openSettings }))) : tabPage === 'discover' ? (React.createElement("div", { className: "ta-main" }, discoverView())) : tabView ? (React.createElement("div", { className: "ta-main" },
|
|
334
281
|
React.createElement(PageView, { view: tabView }))) : (React.createElement("div", { className: "ta-sidebar" }, sideList))), screen: React.createElement(React.Fragment, null,
|
|
@@ -356,26 +303,4 @@ export function AppShell() {
|
|
|
356
303
|
return (React.createElement(AppContexts, { fileUrl: fileUrl, openLink: openLink },
|
|
357
304
|
React.createElement(WorkbenchToggleContext.Provider, { value: toggle }, content)));
|
|
358
305
|
}
|
|
359
|
-
/**
|
|
360
|
-
* What a tab of a phone shows, and the conversations going on (ui.showChats with `busy`) pushed over it while
|
|
361
|
-
* `busy`, as the folder of the chats is pushed over their list: back with its button, a swipe from the left edge or the
|
|
362
|
-
* back of the system (PhoneStack, a layer of BackLayers), to the tab as it was; a conversation picked in it comes over
|
|
363
|
-
* it, and goes back to it. Drawn while open and while it slides away. Not over a page of an extension's own in the
|
|
364
|
-
* tabs (`pushable`, SideListUtil.pushesOver): the page is drawn as it is, the shell shows those going on over the chats.
|
|
365
|
-
*/
|
|
366
|
-
function PhoneHome({ pushable, busy, onBusy, busyList, children, }) {
|
|
367
|
-
const [drawn, setDrawn] = React.useState(busy);
|
|
368
|
-
React.useEffect(() => {
|
|
369
|
-
if (busy) {
|
|
370
|
-
setDrawn(true);
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
const timer = setTimeout(() => setDrawn(false), DeviceMotion.SHEET_MS);
|
|
374
|
-
return () => clearTimeout(timer);
|
|
375
|
-
}, [busy]);
|
|
376
|
-
if (!pushable) {
|
|
377
|
-
return children;
|
|
378
|
-
}
|
|
379
|
-
return React.createElement(PhoneStack, { base: children, top: (busy || drawn) && busyList(), open: busy, onClose: () => onBusy(false) });
|
|
380
|
-
}
|
|
381
306
|
//# sourceMappingURL=app-view.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TaAuthProvider } from '@celljs/ta-protocol';
|
|
2
|
+
/** Where a newcomer gets a key of a provider of models, and what it costs: the pages of the provider. */
|
|
3
|
+
export interface AuthGuide {
|
|
4
|
+
/** The page that makes keys. */
|
|
5
|
+
keys: string;
|
|
6
|
+
/** The prices, paid by use. */
|
|
7
|
+
pricing: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Which providers of keys the page of models puts first, by the language of the page, and how to get their keys
|
|
11
|
+
* (docs/design/ta-simple.md 5, 3 and 8): one a newcomer can pay for and reach from where that language is spoken.
|
|
12
|
+
*/
|
|
13
|
+
export declare namespace AuthGuideUtil {
|
|
14
|
+
function guide(providerId: string): AuthGuide | undefined;
|
|
15
|
+
/** The ids of the providers of keys put first for `language` (a locale, `zh-CN`). */
|
|
16
|
+
function recommended(language: string): string[];
|
|
17
|
+
/**
|
|
18
|
+
* The providers of keys as the page lists them before a search: those recommended for `language`, in their order,
|
|
19
|
+
* and those the user added or signed in to, first; the others under "more".
|
|
20
|
+
*/
|
|
21
|
+
function split(keys: TaAuthProvider[], language: string): {
|
|
22
|
+
first: TaAuthProvider[];
|
|
23
|
+
more: TaAuthProvider[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which providers of keys the page of models puts first, by the language of the page, and how to get their keys
|
|
3
|
+
* (docs/design/ta-simple.md 5, 3 and 8): one a newcomer can pay for and reach from where that language is spoken.
|
|
4
|
+
*/
|
|
5
|
+
export var AuthGuideUtil;
|
|
6
|
+
(function (AuthGuideUtil) {
|
|
7
|
+
const GUIDES = {
|
|
8
|
+
deepseek: { keys: 'https://platform.deepseek.com/api_keys', pricing: 'https://api-docs.deepseek.com/quick_start/pricing' },
|
|
9
|
+
'moonshotai-cn': { keys: 'https://platform.kimi.com/console/api-keys', pricing: 'https://platform.kimi.com/docs/pricing/chat' },
|
|
10
|
+
openai: { keys: 'https://platform.openai.com/api-keys', pricing: 'https://openai.com/api/pricing/' },
|
|
11
|
+
anthropic: { keys: 'https://platform.claude.com/settings/keys', pricing: 'https://claude.com/pricing' },
|
|
12
|
+
google: { keys: 'https://aistudio.google.com/apikey', pricing: 'https://ai.google.dev/gemini-api/docs/pricing' },
|
|
13
|
+
};
|
|
14
|
+
/** By the first part of the language (`zh`), or the whole of it (`zh-TW`); English for the others. */
|
|
15
|
+
const RECOMMENDED = {
|
|
16
|
+
zh: ['deepseek', 'moonshotai-cn'],
|
|
17
|
+
'zh-TW': ['deepseek', 'openai', 'google'],
|
|
18
|
+
en: ['openai', 'anthropic', 'google'],
|
|
19
|
+
ja: ['openai', 'anthropic', 'google'],
|
|
20
|
+
};
|
|
21
|
+
function guide(providerId) {
|
|
22
|
+
return GUIDES[providerId];
|
|
23
|
+
}
|
|
24
|
+
AuthGuideUtil.guide = guide;
|
|
25
|
+
/** The ids of the providers of keys put first for `language` (a locale, `zh-CN`). */
|
|
26
|
+
function recommended(language) {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
return (_b = (_a = RECOMMENDED[language]) !== null && _a !== void 0 ? _a : RECOMMENDED[language.split('-')[0]]) !== null && _b !== void 0 ? _b : RECOMMENDED.en;
|
|
29
|
+
}
|
|
30
|
+
AuthGuideUtil.recommended = recommended;
|
|
31
|
+
/**
|
|
32
|
+
* The providers of keys as the page lists them before a search: those recommended for `language`, in their order,
|
|
33
|
+
* and those the user added or signed in to, first; the others under "more".
|
|
34
|
+
*/
|
|
35
|
+
function split(keys, language) {
|
|
36
|
+
const ids = recommended(language);
|
|
37
|
+
const own = (provider) => !!provider.custom || !!provider.configured;
|
|
38
|
+
const picked = ids.map(id => keys.find(provider => provider.id === id && !own(provider))).filter((one) => !!one);
|
|
39
|
+
const first = [...keys.filter(own), ...picked];
|
|
40
|
+
return { first, more: keys.filter(provider => !first.includes(provider)) };
|
|
41
|
+
}
|
|
42
|
+
AuthGuideUtil.split = split;
|
|
43
|
+
})(AuthGuideUtil || (AuthGuideUtil = {}));
|
|
44
|
+
//# sourceMappingURL=auth-guide.js.map
|
|
@@ -33,6 +33,8 @@ export declare namespace AuthUtil {
|
|
|
33
33
|
};
|
|
34
34
|
result?: 'done' | 'failed' | 'cancelled';
|
|
35
35
|
error?: string;
|
|
36
|
+
/** The service refused the key typed in, which was not kept: another one is to be typed. */
|
|
37
|
+
refused?: boolean;
|
|
36
38
|
}
|
|
37
39
|
function reduce(state: FlowState, event: TaAuthEvent): FlowState;
|
|
38
40
|
}
|
|
@@ -5,8 +5,9 @@ import { useBackLayer } from '../device/back-stack.js';
|
|
|
5
5
|
import { ExtensionBoundary } from '../extension/extension-view.js';
|
|
6
6
|
import { WebLabelUtil } from '../extension/web-extension-protocol.js';
|
|
7
7
|
import { useNotices, useWebExtensions, useWorkbench } from '../hooks.js';
|
|
8
|
-
import { useT } from '../i18n/use-t.js';
|
|
8
|
+
import { useLanguage, useT } from '../i18n/use-t.js';
|
|
9
9
|
import { WorkbenchUtil } from '../workbench-util.js';
|
|
10
|
+
import { AuthGuideUtil } from './auth-guide.js';
|
|
10
11
|
import { AuthPicture } from './auth-pictures.js';
|
|
11
12
|
import { Callout } from './callout.js';
|
|
12
13
|
import { CustomProviderForm } from './custom-provider-view.js';
|
|
@@ -55,7 +56,7 @@ export var AuthUtil;
|
|
|
55
56
|
case 'done':
|
|
56
57
|
return { ...state, prompt: undefined, result: 'done' };
|
|
57
58
|
case 'failed':
|
|
58
|
-
return { ...state, prompt: undefined, result: event.cancelled ? 'cancelled' : 'failed', error: event.message };
|
|
59
|
+
return { ...state, prompt: undefined, result: event.cancelled ? 'cancelled' : 'failed', error: event.message, refused: event.refused };
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
AuthUtil.reduce = reduce;
|
|
@@ -86,7 +87,7 @@ function open(url) {
|
|
|
86
87
|
window.open(url, '_blank', 'noopener,noreferrer');
|
|
87
88
|
}
|
|
88
89
|
/** One sign-in, run on the server: what it shows, and what it asks. */
|
|
89
|
-
function AuthFlow({ provider, onDone, onBack }) {
|
|
90
|
+
function AuthFlow({ provider, onDone, onBack, onRetry }) {
|
|
90
91
|
var _a, _b, _c;
|
|
91
92
|
const t = useT();
|
|
92
93
|
const [workbench, bench] = useWorkbench();
|
|
@@ -140,6 +141,7 @@ function AuthFlow({ provider, onDone, onBack }) {
|
|
|
140
141
|
}
|
|
141
142
|
};
|
|
142
143
|
const kind = provider.type === 'api_key' ? t('ta.auth.apiKey') : provider.subscription ? t('ta.auth.subscription') : t('ta.auth.account');
|
|
144
|
+
const guide = provider.type === 'api_key' ? AuthGuideUtil.guide(provider.id) : undefined;
|
|
143
145
|
return (React.createElement("div", { className: "ta-auth-flow" },
|
|
144
146
|
React.createElement("div", { className: "ta-auth-flow-head" },
|
|
145
147
|
React.createElement(IconButton, { icon: ArrowLeft, label: t('ta.auth.back'), onClick: onBack }),
|
|
@@ -197,9 +199,15 @@ function AuthFlow({ provider, onDone, onBack }) {
|
|
|
197
199
|
React.createElement("label", { className: "ta-field" },
|
|
198
200
|
React.createElement(KeyRound, { size: 16, strokeWidth: 1.75, "aria-hidden": "true" }),
|
|
199
201
|
React.createElement("input", { type: prompt.prompt.type === 'secret' ? 'password' : 'text', autoFocus: true, autoComplete: "off", spellCheck: false, placeholder: (_a = prompt.prompt.placeholder) !== null && _a !== void 0 ? _a : (prompt.prompt.type === 'secret' ? t('ta.auth.apiKey') : ''), value: answer, onChange: event => setAnswer(event.target.value) })),
|
|
202
|
+
prompt.prompt.type === 'secret' && guide && (React.createElement("p", { className: "ta-auth-guide" },
|
|
203
|
+
t('ta.auth.keyGuide', { name: provider.name }),
|
|
204
|
+
' ',
|
|
205
|
+
React.createElement("a", { href: guide.keys, target: "_blank", rel: "noreferrer", className: "ta-auth-link" }, t('ta.auth.keyPage')),
|
|
206
|
+
' · ',
|
|
207
|
+
React.createElement("a", { href: guide.pricing, target: "_blank", rel: "noreferrer", className: "ta-auth-link" }, t('ta.auth.pricing')))),
|
|
200
208
|
React.createElement("button", { type: "submit", className: "ta-button ta-primary ta-wide", disabled: !answer.trim() }, t('ta.auth.continue'))))),
|
|
201
209
|
!state.result && !prompt && React.createElement(Loading, { compact: true, label: (_b = state.progress) !== null && _b !== void 0 ? _b : t('ta.auth.waiting') }),
|
|
202
|
-
state.result === 'failed' && (React.createElement(Callout, { level: "error", action: React.createElement("button", { type: "button", className: "ta-button", onClick: onBack }, t('ta.auth.back')) }, t('ta.auth.failed', { message: (_c = state.error) !== null && _c !== void 0 ? _c : '' })))));
|
|
210
|
+
state.result === 'failed' && (React.createElement(Callout, { level: "error", action: state.refused ? (React.createElement("button", { type: "button", className: "ta-button", onClick: onRetry }, t('ta.auth.keyAgain'))) : (React.createElement("button", { type: "button", className: "ta-button", onClick: onBack }, t('ta.auth.back'))) }, state.refused ? t('ta.auth.keyRefused', { name: provider.name }) : t('ta.auth.failed', { message: (_c = state.error) !== null && _c !== void 0 ? _c : '' })))));
|
|
203
211
|
}
|
|
204
212
|
function ProviderRow({ provider, onPick, onSignOut, plain }) {
|
|
205
213
|
var _a, _b;
|
|
@@ -258,7 +266,12 @@ export function AuthPanel({ onSignedIn, onProviders, kinds }) {
|
|
|
258
266
|
const [, notices] = useNotices();
|
|
259
267
|
const [providers, reload] = useAuthProviders(workbench.status === 'online');
|
|
260
268
|
const [picked, setPicked] = React.useState();
|
|
269
|
+
/** Sign-ins of `picked` begun: one more begins it again, as after a key the service refused. */
|
|
270
|
+
const [tries, setTries] = React.useState(0);
|
|
261
271
|
const [words, setWords] = React.useState('');
|
|
272
|
+
const language = useLanguage();
|
|
273
|
+
/** The providers of keys under "more" are shown. */
|
|
274
|
+
const [more, setMore] = React.useState(false);
|
|
262
275
|
/** On the first page: which way the user chose, before the providers of that way. */
|
|
263
276
|
const [kind, setKind] = React.useState();
|
|
264
277
|
/** A provider the user adds by its address (`new`), or one added so, being changed. */
|
|
@@ -284,7 +297,7 @@ export function AuthPanel({ onSignedIn, onProviders, kinds }) {
|
|
|
284
297
|
} }));
|
|
285
298
|
}
|
|
286
299
|
if (picked) {
|
|
287
|
-
return React.createElement(AuthFlow, { provider: picked, onDone: done, onBack: back });
|
|
300
|
+
return React.createElement(AuthFlow, { key: tries, provider: picked, onDone: done, onBack: back, onRetry: () => setTries(value => value + 1) });
|
|
288
301
|
}
|
|
289
302
|
if (!providers) {
|
|
290
303
|
return React.createElement(Loading, null);
|
|
@@ -327,10 +340,16 @@ export function AuthPanel({ onSignedIn, onProviders, kinds }) {
|
|
|
327
340
|
const offered = AuthUtil.offered(providers, words);
|
|
328
341
|
const accounts = kind === 'api_key' ? [] : offered.accounts;
|
|
329
342
|
const keys = kind === 'oauth' ? [] : offered.keys;
|
|
330
|
-
|
|
343
|
+
// Before a search, a few to pick from (those of the language of the page, and the user's own); the others folded.
|
|
344
|
+
const split = words.trim() ? { first: keys, more: [] } : AuthGuideUtil.split(keys, language);
|
|
345
|
+
const shownKeys = more ? keys : split.first;
|
|
346
|
+
const group = (title, list, after) => (list.length > 0 || after) && (React.createElement("section", { className: "ta-auth-group" },
|
|
331
347
|
title && React.createElement("h3", null, title),
|
|
332
|
-
|
|
333
|
-
|
|
348
|
+
list.map(provider => (React.createElement(ProviderRow, { key: AuthUtil.key(provider), provider: provider, plain: kind !== undefined, onPick: () => (provider.custom ? edit(provider) : setPicked(provider)), onSignOut: () => void signOut(provider) }))),
|
|
349
|
+
after));
|
|
350
|
+
const unfold = !more && split.more.length > 0 && (React.createElement("button", { type: "button", className: "ta-auth-item ta-auth-more", onClick: () => setMore(true) },
|
|
351
|
+
React.createElement("span", { className: "ta-auth-name" }, t('ta.auth.more', { count: split.more.length })),
|
|
352
|
+
React.createElement(Icon, { icon: ChevronRight, size: 15 })));
|
|
334
353
|
// Whatever is searched: a service not in the list is one to add.
|
|
335
354
|
const add = kind !== 'oauth' && (React.createElement("button", { type: "button", className: "ta-auth-item ta-custom-add", onClick: () => setEditing('new') },
|
|
336
355
|
React.createElement(Icon, { icon: Plus, size: 15 }),
|
|
@@ -346,7 +365,9 @@ export function AuthPanel({ onSignedIn, onProviders, kinds }) {
|
|
|
346
365
|
React.createElement("input", { placeholder: t('ta.auth.search'), value: words, onChange: event => setWords(event.target.value) })),
|
|
347
366
|
React.createElement("div", { className: "ta-auth-list" },
|
|
348
367
|
group(kind ? '' : t('ta.auth.accounts'), accounts),
|
|
349
|
-
group(kind ? '' : t('ta.auth.keys'),
|
|
368
|
+
group(kind ? '' : t('ta.auth.keys'), shownKeys, (unfold || add) && (React.createElement(React.Fragment, null,
|
|
369
|
+
unfold,
|
|
370
|
+
add))),
|
|
350
371
|
accounts.length + keys.length === 0 && !add && React.createElement(EmptyState, { compact: true, title: t('ta.auth.none') }))));
|
|
351
372
|
}
|
|
352
373
|
/** The model accounts, over the page (the gear menu). */
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ChatSource } from './chat-list-util.js';
|
|
3
|
+
/** The head of the list: its search, the switch of the list by directory (`byDirectory`, when there are several), and `+`. */
|
|
4
|
+
export declare function ChatSearchHead({ query, onQuery, byDirectory, onByDirectory, onNew, }: {
|
|
5
|
+
query: string;
|
|
6
|
+
onQuery(query: string): void;
|
|
7
|
+
/** Undefined: no switch, as for one directory. */
|
|
8
|
+
byDirectory?: boolean;
|
|
9
|
+
onByDirectory(byDirectory: boolean): void;
|
|
10
|
+
onNew(): void;
|
|
11
|
+
}): React.JSX.Element;
|
|
12
|
+
/** The head of a group of the list by directory: folds it; what it adds after (a `+` of its own) as `children`. */
|
|
13
|
+
export declare function ChatGroupHead({ open, title, onFold, leading, label, count, children, }: {
|
|
14
|
+
open: boolean;
|
|
15
|
+
title?: string;
|
|
16
|
+
onFold(): void;
|
|
17
|
+
leading: React.ReactNode;
|
|
18
|
+
label: string;
|
|
19
|
+
count: number;
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
}): React.JSX.Element;
|
|
22
|
+
/** The mark of a directory or package at the head of its group: its initial in its tone, and the host it is on. */
|
|
23
|
+
export declare function ChatSourceMark({ source }: {
|
|
24
|
+
source: ChatSource;
|
|
25
|
+
}): React.JSX.Element;
|
|
26
|
+
/** The head of a list pushed over the list (a folder, those going on): back, its title and how many. */
|
|
27
|
+
export declare function ChatFolderHead({ title, count, onBack }: {
|
|
28
|
+
title: string;
|
|
29
|
+
count: number;
|
|
30
|
+
onBack(): void;
|
|
31
|
+
}): React.JSX.Element;
|
|
32
|
+
/** A toggle of what folds under a title: the older conversations, the archive, those taken out. */
|
|
33
|
+
export declare function ChatFoldToggle({ label, open, onClick, title }: {
|
|
34
|
+
label: string;
|
|
35
|
+
open: boolean;
|
|
36
|
+
onClick(): void;
|
|
37
|
+
title?: string;
|
|
38
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ChevronLeft, ChevronRight, FolderTree, Plus, Search, X } from 'lucide-react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useT } from '../i18n/use-t.js';
|
|
4
|
+
import { HostTag } from './host-tag.js';
|
|
5
|
+
import { Icon, IconButton } from './icon.js';
|
|
6
|
+
/** The head of the list: its search, the switch of the list by directory (`byDirectory`, when there are several), and `+`. */
|
|
7
|
+
export function ChatSearchHead({ query, onQuery, byDirectory, onByDirectory, onNew, }) {
|
|
8
|
+
const t = useT();
|
|
9
|
+
return (React.createElement("header", { className: "ta-chats-head" },
|
|
10
|
+
React.createElement("label", { className: "ta-chats-search" },
|
|
11
|
+
React.createElement(Icon, { icon: Search, size: 15 }),
|
|
12
|
+
React.createElement("input", { value: query, placeholder: t('ta.chat.search'), "aria-label": t('ta.chat.search'), onChange: event => onQuery(event.target.value) }),
|
|
13
|
+
query ? (React.createElement(IconButton, { className: "ta-chats-clear", icon: X, label: t('ta.close'), onClick: () => onQuery('') })) : (byDirectory !== undefined && (React.createElement(IconButton, { className: "ta-chats-view", icon: FolderTree, label: t('ta.chat.byDirectory'), "aria-pressed": byDirectory, onClick: () => onByDirectory(!byDirectory) })))),
|
|
14
|
+
React.createElement(IconButton, { className: "ta-chats-add", icon: Plus, label: t('ta.chat.new'), onClick: onNew })));
|
|
15
|
+
}
|
|
16
|
+
/** The head of a group of the list by directory: folds it; what it adds after (a `+` of its own) as `children`. */
|
|
17
|
+
export function ChatGroupHead({ open, title, onFold, leading, label, count, children, }) {
|
|
18
|
+
return (React.createElement("div", { className: "ta-chat-group-head" },
|
|
19
|
+
React.createElement("button", { type: "button", className: "ta-chat-group-toggle", "aria-expanded": open, title: title, onClick: onFold },
|
|
20
|
+
leading,
|
|
21
|
+
React.createElement("span", { className: "ta-chat-group-label" }, label),
|
|
22
|
+
React.createElement("span", { className: "ta-chat-group-count" }, count),
|
|
23
|
+
React.createElement(Icon, { icon: ChevronRight, size: 13, className: "ta-chat-group-chevron" })),
|
|
24
|
+
children));
|
|
25
|
+
}
|
|
26
|
+
/** The mark of a directory or package at the head of its group: its initial in its tone, and the host it is on. */
|
|
27
|
+
export function ChatSourceMark({ source }) {
|
|
28
|
+
return (React.createElement(React.Fragment, null,
|
|
29
|
+
React.createElement("span", { className: `ta-chat-group-avatar ta-tone-${source.tone}`, "aria-hidden": "true" }, source.initial),
|
|
30
|
+
React.createElement(HostTag, { host: source.host })));
|
|
31
|
+
}
|
|
32
|
+
/** The head of a list pushed over the list (a folder, those going on): back, its title and how many. */
|
|
33
|
+
export function ChatFolderHead({ title, count, onBack }) {
|
|
34
|
+
const t = useT();
|
|
35
|
+
return (React.createElement("div", { className: "ta-chat-folder-head" },
|
|
36
|
+
React.createElement(IconButton, { className: "ta-chat-folder-back", icon: ChevronLeft, label: t('ta.back'), onClick: onBack }),
|
|
37
|
+
React.createElement("span", { className: "ta-chat-folder-title" }, title),
|
|
38
|
+
React.createElement("span", { className: "ta-chat-group-count" }, count)));
|
|
39
|
+
}
|
|
40
|
+
/** A toggle of what folds under a title: the older conversations, the archive, those taken out. */
|
|
41
|
+
export function ChatFoldToggle({ label, open, onClick, title }) {
|
|
42
|
+
return (React.createElement("button", { type: "button", className: "ta-chat-section-title ta-chat-fold", "aria-expanded": open, title: title, onClick: onClick },
|
|
43
|
+
React.createElement(Icon, { icon: ChevronRight, size: 13 }),
|
|
44
|
+
label));
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=chat-list-controls.js.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { WebChat, WebHomeEntry } from '../extension/web-extension-api.js';
|
|
3
|
+
import type { Translate } from '../i18n/use-t.js';
|
|
4
|
+
import { type LetGoAsks } from './chat-asks.js';
|
|
3
5
|
import type { ChatTaskHome } from './chat-home.js';
|
|
4
6
|
import { type ChatHome } from './chat-home-util.js';
|
|
5
7
|
import type { ChatFolderIcon } from './chat-icon.js';
|
|
@@ -50,3 +52,20 @@ export declare function useRowCalls(given: {
|
|
|
50
52
|
/** Pins or unpins a conversation's file or a folder's key: the last pinned first, as several may be. */
|
|
51
53
|
pinKey(key: string, pin: boolean): void;
|
|
52
54
|
};
|
|
55
|
+
/** What an agent reads of the list and does to it (docs/design/ta-app-use.md 3): the screen keeps the rows drawn in sight. */
|
|
56
|
+
export declare function useChatsScreen(given: {
|
|
57
|
+
title: string;
|
|
58
|
+
shown: readonly ChatEntry[];
|
|
59
|
+
/** The rows drawn in sight: those of the folder opened, else of the list. */
|
|
60
|
+
inSight(): ChatEntry[];
|
|
61
|
+
letGo: LetGoAsks;
|
|
62
|
+
isUnseen(entry: ChatEntry): boolean;
|
|
63
|
+
pinned: ReadonlySet<string>;
|
|
64
|
+
hasDraft(entry: ChatEntry): boolean;
|
|
65
|
+
open(entry: ChatEntry): void;
|
|
66
|
+
pinKey(key: string, pin: boolean): void;
|
|
67
|
+
search(text: string): void;
|
|
68
|
+
/** Whether rows are left to draw below. */
|
|
69
|
+
more(): boolean;
|
|
70
|
+
t: Translate;
|
|
71
|
+
}): void;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useInject } from '@celljs/react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { useScreenPart } from '../screen/use-screen-part.js';
|
|
3
4
|
import { TaState } from '../state/state-protocol.js';
|
|
5
|
+
import { ChatAskUtil } from './chat-asks.js';
|
|
4
6
|
import { ChatHomeUtil } from './chat-home-util.js';
|
|
5
7
|
import { ChatListUtil, PIN_OFFERED, PINNED } from './chat-list-util.js';
|
|
6
8
|
import { useListMotion } from './list-motion.js';
|
|
@@ -105,4 +107,54 @@ export function useRowCalls(given) {
|
|
|
105
107
|
openFolder: (key, archived) => latest.current.openFolder(key, archived),
|
|
106
108
|
}), []);
|
|
107
109
|
}
|
|
110
|
+
/** What an agent reads of the list and does to it (docs/design/ta-app-use.md 3): the screen keeps the rows drawn in sight. */
|
|
111
|
+
export function useChatsScreen(given) {
|
|
112
|
+
const { title, shown, inSight, letGo, isUnseen, pinned, hasDraft, open, pinKey, search, more, t } = given;
|
|
113
|
+
useScreenPart({
|
|
114
|
+
id: 'chats',
|
|
115
|
+
title,
|
|
116
|
+
state: () => t('ta.screen.chats', { count: shown.length, unread: shown.filter(isUnseen).length }),
|
|
117
|
+
items: () => inSight().map(entry => {
|
|
118
|
+
var _a;
|
|
119
|
+
const asking = (_a = ChatAskUtil.asking(entry, letGo)) === null || _a === void 0 ? void 0 : _a.question;
|
|
120
|
+
const marks = [
|
|
121
|
+
...(asking ? [t('ta.screen.asks', { question: asking })] : []),
|
|
122
|
+
...(isUnseen(entry) ? [t('ta.screen.unread')] : []),
|
|
123
|
+
...(pinned.has(ChatListUtil.file(entry)) ? [t('ta.chat.pinned')] : []),
|
|
124
|
+
...(ChatListUtil.isOpen(entry) && entry.isStreaming ? [t('ta.screen.working')] : []),
|
|
125
|
+
...(hasDraft(entry) ? [t('ta.chat.draft')] : []),
|
|
126
|
+
];
|
|
127
|
+
return { id: ChatListUtil.file(entry), text: ChatListUtil.title(entry, t), ...(marks.length ? { marks } : {}) };
|
|
128
|
+
}),
|
|
129
|
+
actions: {
|
|
130
|
+
open: {
|
|
131
|
+
label: t('ta.screen.open'),
|
|
132
|
+
each: true,
|
|
133
|
+
run: file => {
|
|
134
|
+
const entry = inSight().find(one => ChatListUtil.file(one) === file);
|
|
135
|
+
if (entry) {
|
|
136
|
+
open(entry);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
pin: {
|
|
141
|
+
label: t('ta.chat.pin'),
|
|
142
|
+
each: true,
|
|
143
|
+
command: 'chats.pin',
|
|
144
|
+
commandInput: file => ({ file, pinned: true }),
|
|
145
|
+
run: file => pinKey(file !== null && file !== void 0 ? file : '', true),
|
|
146
|
+
},
|
|
147
|
+
unpin: {
|
|
148
|
+
label: t('ta.chat.unpin'),
|
|
149
|
+
each: true,
|
|
150
|
+
command: 'chats.pin',
|
|
151
|
+
commandInput: file => ({ file, pinned: false }),
|
|
152
|
+
run: file => pinKey(file !== null && file !== void 0 ? file : '', false),
|
|
153
|
+
},
|
|
154
|
+
stop: { label: t('ta.stop'), each: true, command: 'chats.stop', commandInput: file => ({ file }) },
|
|
155
|
+
search: { label: t('ta.chat.search'), takes: 'text', run: (_file, input) => { var _a; return search(String((_a = input.text) !== null && _a !== void 0 ? _a : '')); } },
|
|
156
|
+
},
|
|
157
|
+
scroll: { more: () => (more() ? 'bottom' : undefined) },
|
|
158
|
+
});
|
|
159
|
+
}
|
|
108
160
|
//# sourceMappingURL=chat-list-hooks.js.map
|