@celljs/ta-web 4.9.0 → 4.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/assistant/assistant-extension.js +13 -5
- package/esm/browser/assistant/assistant-task-source.d.ts +2 -0
- package/esm/browser/assistant/assistant-task-source.js +2 -0
- package/esm/browser/assistant/assistant-task-util.d.ts +6 -0
- package/esm/browser/assistant/assistant-task-util.js +8 -0
- package/esm/browser/assistant/assistant-tasks.js +3 -2
- package/esm/browser/assistant/assistant.d.ts +20 -0
- package/esm/browser/assistant/assistant.js +45 -1
- package/esm/browser/assistant/task-views.d.ts +40 -6
- package/esm/browser/assistant/task-views.js +73 -21
- package/esm/browser/avatar/dino-avatar.d.ts +3 -4
- package/esm/browser/avatar/dino-avatar.js +4 -178
- package/esm/browser/avatar/dino-face.d.ts +19 -0
- package/esm/browser/avatar/dino-face.js +142 -0
- package/esm/browser/avatar/dino-geometry.d.ts +11 -0
- package/esm/browser/avatar/dino-geometry.js +38 -0
- package/esm/browser/avatar/dino-kinds.d.ts +15 -0
- package/esm/browser/avatar/dino-kinds.js +544 -0
- package/esm/browser/avatar/dino-motion.js +1 -1
- package/esm/browser/avatar/dino-shape.d.ts +80 -0
- package/esm/browser/avatar/dino-shape.js +113 -0
- package/esm/browser/avatar/dino-species.d.ts +1 -61
- package/esm/browser/avatar/dino-species.js +2 -653
- package/esm/browser/components/access-view.js +1 -1
- package/esm/browser/components/account-menu.js +1 -1
- package/esm/browser/components/app-shell-hooks.d.ts +47 -0
- package/esm/browser/components/app-shell-hooks.js +165 -0
- package/esm/browser/components/app-view.js +6 -151
- package/esm/browser/components/auth-view.js +1 -1
- package/esm/browser/components/composer.js +17 -10
- package/esm/browser/components/dino.js +1 -1
- package/esm/browser/components/folder-picker.js +4 -1
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/host-view.js +1 -1
- package/esm/browser/components/select-bar.d.ts +9 -0
- package/esm/browser/components/select-bar.js +24 -0
- package/esm/browser/components/settings-choices.d.ts +35 -0
- package/esm/browser/components/settings-choices.js +117 -0
- package/esm/browser/components/settings-parts.d.ts +21 -0
- package/esm/browser/components/settings-parts.js +300 -0
- package/esm/browser/components/settings-view.d.ts +0 -6
- package/esm/browser/components/settings-view.js +4 -406
- package/esm/browser/components/workbench-view.js +1 -1
- package/esm/browser/extension/icons.js +2 -1
- package/esm/browser/extension/web-extension-api.d.ts +38 -1
- package/esm/browser/extension/web-extensions.js +6 -1
- package/esm/browser/extension/web-tasks.d.ts +9 -1
- package/esm/browser/extension/web-tasks.js +24 -0
- package/esm/browser/hooks.d.ts +3 -1
- package/esm/browser/hooks.js +8 -0
- package/esm/browser/i18n/locales.d.ts +6 -1
- package/esm/browser/i18n/messages.d.ts +5 -0
- package/esm/browser/i18n/messages.js +10 -0
- package/esm/browser/style/device.js +16 -0
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +1 -0
- package/esm/browser/style/tasks.d.ts +1 -1
- package/esm/browser/style/tasks.js +2 -0
- package/esm/browser/workbench-util.d.ts +61 -0
- package/esm/browser/workbench-util.js +138 -0
- package/esm/browser/workbench.d.ts +1 -37
- package/esm/browser/workbench.js +2 -136
- package/lib/browser/assistant/assistant-extension.js +13 -5
- package/lib/browser/assistant/assistant-task-source.d.ts +2 -0
- package/lib/browser/assistant/assistant-task-source.js +2 -0
- package/lib/browser/assistant/assistant-task-util.d.ts +6 -0
- package/lib/browser/assistant/assistant-task-util.js +8 -0
- package/lib/browser/assistant/assistant-tasks.js +2 -1
- package/lib/browser/assistant/assistant.d.ts +20 -0
- package/lib/browser/assistant/assistant.js +45 -1
- package/lib/browser/assistant/task-views.d.ts +40 -6
- package/lib/browser/assistant/task-views.js +74 -21
- package/lib/browser/avatar/dino-avatar.d.ts +3 -4
- package/lib/browser/avatar/dino-avatar.js +27 -202
- package/lib/browser/avatar/dino-face.d.ts +20 -0
- package/lib/browser/avatar/dino-face.js +148 -0
- package/lib/browser/avatar/dino-geometry.d.ts +12 -0
- package/lib/browser/avatar/dino-geometry.js +47 -0
- package/lib/browser/avatar/dino-kinds.d.ts +16 -0
- package/lib/browser/avatar/dino-kinds.js +547 -0
- package/lib/browser/avatar/dino-motion.js +2 -2
- package/lib/browser/avatar/dino-shape.d.ts +81 -0
- package/lib/browser/avatar/dino-shape.js +126 -0
- package/lib/browser/avatar/dino-species.d.ts +1 -61
- package/lib/browser/avatar/dino-species.js +34 -687
- package/lib/browser/components/access-view.js +2 -2
- package/lib/browser/components/account-menu.js +2 -2
- package/lib/browser/components/app-shell-hooks.d.ts +48 -0
- package/lib/browser/components/app-shell-hooks.js +207 -0
- package/lib/browser/components/app-view.js +16 -161
- package/lib/browser/components/auth-view.js +3 -3
- package/lib/browser/components/composer.js +17 -10
- package/lib/browser/components/dino.js +3 -3
- package/lib/browser/components/folder-picker.js +4 -1
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/host-view.js +5 -5
- package/lib/browser/components/select-bar.d.ts +10 -0
- package/lib/browser/components/select-bar.js +61 -0
- package/lib/browser/components/settings-choices.d.ts +36 -0
- package/lib/browser/components/settings-choices.js +156 -0
- package/lib/browser/components/settings-parts.d.ts +22 -0
- package/lib/browser/components/settings-parts.js +336 -0
- package/lib/browser/components/settings-view.d.ts +0 -6
- package/lib/browser/components/settings-view.js +2 -405
- package/lib/browser/components/workbench-view.js +3 -3
- package/lib/browser/extension/icons.js +1 -0
- package/lib/browser/extension/web-extension-api.d.ts +38 -1
- package/lib/browser/extension/web-extensions.js +5 -0
- package/lib/browser/extension/web-tasks.d.ts +9 -1
- package/lib/browser/extension/web-tasks.js +24 -0
- package/lib/browser/hooks.d.ts +3 -1
- package/lib/browser/hooks.js +9 -0
- package/lib/browser/i18n/locales.d.ts +6 -1
- package/lib/browser/i18n/messages.d.ts +5 -0
- package/lib/browser/i18n/messages.js +10 -0
- package/lib/browser/style/device.js +16 -0
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +1 -0
- package/lib/browser/style/tasks.d.ts +1 -1
- package/lib/browser/style/tasks.js +2 -0
- package/lib/browser/workbench-util.d.ts +62 -0
- package/lib/browser/workbench-util.js +144 -0
- package/lib/browser/workbench.d.ts +1 -37
- package/lib/browser/workbench.js +24 -159
- package/package.json +7 -7
|
@@ -39,7 +39,7 @@ const lucide_react_1 = require("lucide-react");
|
|
|
39
39
|
const React = __importStar(require("react"));
|
|
40
40
|
const hooks_1 = require("../hooks");
|
|
41
41
|
const use_t_1 = require("../i18n/use-t");
|
|
42
|
-
const
|
|
42
|
+
const workbench_util_1 = require("../workbench-util");
|
|
43
43
|
const access_util_1 = require("./access-util");
|
|
44
44
|
const chat_list_1 = require("./chat-list");
|
|
45
45
|
const icon_1 = require("./icon");
|
|
@@ -97,7 +97,7 @@ function AccessSettings({ info, onChange }) {
|
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
// The sign-in goes through the page's own ta serve: not from the app, nor for another computer.
|
|
100
|
-
const here = !
|
|
100
|
+
const here = !workbench_util_1.WorkbenchUtil.isApp() && workbench.host === workbench_util_1.WorkbenchUtil.serverOf({ token: '' }, location.host);
|
|
101
101
|
// Behind a gateway, only its administrators let accounts in; everyone sees the browsers of their own.
|
|
102
102
|
const manage = info.canManage !== false;
|
|
103
103
|
const bind = (provider) => run(async () => {
|
|
@@ -45,7 +45,7 @@ const device_1 = require("../device/device");
|
|
|
45
45
|
const hooks_1 = require("../hooks");
|
|
46
46
|
const hosts_1 = require("../hosts");
|
|
47
47
|
const use_t_1 = require("../i18n/use-t");
|
|
48
|
-
const
|
|
48
|
+
const workbench_util_1 = require("../workbench-util");
|
|
49
49
|
const auth_view_1 = require("./auth-view");
|
|
50
50
|
const dino_look_picker_1 = require("./dino-look-picker");
|
|
51
51
|
const host_view_1 = require("./host-view");
|
|
@@ -121,7 +121,7 @@ function useAccountEntries(onSettings, onDialog) {
|
|
|
121
121
|
entry('hosts', t('ta.hosts.title'), lucide_react_1.Monitor, () => onDialog('hosts'), { detail: inUse && (hosts_1.HostUtil.label(inUse) || t('ta.hosts.thisServer')) }),
|
|
122
122
|
entry('accounts', t('ta.manage.accounts'), lucide_react_1.KeyRound, () => onDialog('accounts')),
|
|
123
123
|
entry('directory', t('ta.manage.workingDirectory'), lucide_react_1.FolderOpen, () => onDialog('directory')),
|
|
124
|
-
...(
|
|
124
|
+
...(workbench_util_1.WorkbenchUtil.isApp() || handheld ? [] : [entry('relay', t('ta.manage.relay'), lucide_react_1.Smartphone, () => onDialog('relay'))]),
|
|
125
125
|
],
|
|
126
126
|
[
|
|
127
127
|
entry('theme', t('ta.settings.theme'), lucide_react_1.Palette, () => onSettings('appearance'), {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { WebViewEntry } from '../extension/web-extension-protocol';
|
|
2
|
+
import type { Theme } from '../settings/settings-protocol';
|
|
3
|
+
import { type StateSpec } from '../state/state-protocol';
|
|
4
|
+
import type { PaneSpec } from '../util/layout';
|
|
5
|
+
/**
|
|
6
|
+
* What the sidebar shows in this tab: `` for the chats, else the id of a sidebar view. Until the user picks
|
|
7
|
+
* a tab, the first sidebar view of web extensions (the agents), or the chats if there is none.
|
|
8
|
+
*/
|
|
9
|
+
export declare const FIRST_SIDE = "*";
|
|
10
|
+
/** A page of ta's own in place of the conversation: Discover (a tab of a phone, a page of the rail), Me (a tab of a phone). */
|
|
11
|
+
export type TabPage = 'discover' | 'me';
|
|
12
|
+
/** The user put off signing in to a model, in this tab: the page shows the app until the tab is reopened. */
|
|
13
|
+
export declare const LOGIN_LATER: StateSpec<boolean>;
|
|
14
|
+
export declare const SIDE: StateSpec<string>;
|
|
15
|
+
export declare const SIDEBAR: PaneSpec;
|
|
16
|
+
export declare const EDITOR: PaneSpec;
|
|
17
|
+
/** The width of the navigation rail, in style.ts. */
|
|
18
|
+
export declare const RAIL = 56;
|
|
19
|
+
/** The cards of web extensions, as a tool of the workbench and its tab. */
|
|
20
|
+
export declare const CARDS_ID = "ta/cards";
|
|
21
|
+
/**
|
|
22
|
+
* Whether the right of the page (editors and cards) shows; on narrow screens it starts hidden. The last of
|
|
23
|
+
* them hides it where it lies over the conversation, the user's choice kept.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useRight(): [boolean, () => void, () => void, () => void];
|
|
26
|
+
/** Cmd/Ctrl+B shows or hides the sidebar and Cmd/Ctrl+, opens the settings, as in an IDE. */
|
|
27
|
+
export declare function useKeys(toggle: () => void, openSettings: () => void): void;
|
|
28
|
+
/**
|
|
29
|
+
* The installed app with its title bar hidden draws the bar itself (see .ta-titlebar), but the browser
|
|
30
|
+
* paints the corners of the window's buttons with theme-color: the traffic lights at the left over the
|
|
31
|
+
* side columns, its own buttons at the right. So the bar is the colour of the side columns throughout, the
|
|
32
|
+
* conversation below it too. Otherwise the whole title bar has the conversation's colour, as the sign-in page.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useTitlebarColor(signedIn: boolean, theme: Theme): void;
|
|
35
|
+
/** Reads the open sessions and the web extensions again while the tab is visible: other clients change them too. */
|
|
36
|
+
export declare function useRefresh(online: boolean): void;
|
|
37
|
+
/** The drawer of a compact layout comes out from the left edge under the finger, and goes the same way. */
|
|
38
|
+
export declare function useDrawerSwipe(enabled: boolean, open: boolean, setOpen: (open: boolean) => void): void;
|
|
39
|
+
/**
|
|
40
|
+
* The cards of web extensions as a tool of the workbench and its tab: the tab opens when the first card
|
|
41
|
+
* comes while the workbench `shown` has nothing else open, and goes with the last card.
|
|
42
|
+
*/
|
|
43
|
+
export declare function useWorkbenchCards(shown: boolean): {
|
|
44
|
+
hasCards: boolean;
|
|
45
|
+
openCards(): void;
|
|
46
|
+
cardsTool: WebViewEntry;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=app-shell-hooks.d.ts.map
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.CARDS_ID = exports.RAIL = exports.EDITOR = exports.SIDEBAR = exports.SIDE = exports.LOGIN_LATER = exports.FIRST_SIDE = void 0;
|
|
37
|
+
exports.useRight = useRight;
|
|
38
|
+
exports.useKeys = useKeys;
|
|
39
|
+
exports.useTitlebarColor = useTitlebarColor;
|
|
40
|
+
exports.useRefresh = useRefresh;
|
|
41
|
+
exports.useDrawerSwipe = useDrawerSwipe;
|
|
42
|
+
exports.useWorkbenchCards = useWorkbenchCards;
|
|
43
|
+
const lucide_react_1 = require("lucide-react");
|
|
44
|
+
const React = __importStar(require("react"));
|
|
45
|
+
const device_1 = require("../device/device");
|
|
46
|
+
const sheet_swipe_1 = require("../device/sheet-swipe");
|
|
47
|
+
const hooks_1 = require("../hooks");
|
|
48
|
+
const messages_1 = require("../i18n/messages");
|
|
49
|
+
const settings_1 = require("../settings/settings");
|
|
50
|
+
const state_protocol_1 = require("../state/state-protocol");
|
|
51
|
+
const editor_area_1 = require("./editor-area");
|
|
52
|
+
/**
|
|
53
|
+
* What the sidebar shows in this tab: `` for the chats, else the id of a sidebar view. Until the user picks
|
|
54
|
+
* a tab, the first sidebar view of web extensions (the agents), or the chats if there is none.
|
|
55
|
+
*/
|
|
56
|
+
exports.FIRST_SIDE = '*';
|
|
57
|
+
/** The user put off signing in to a model, in this tab: the page shows the app until the tab is reopened. */
|
|
58
|
+
exports.LOGIN_LATER = { key: 'login.later', tier: 'tab', initial: false, parse: state_protocol_1.StateUtil.boolean };
|
|
59
|
+
exports.SIDE = { key: 'side', tier: 'tab', initial: exports.FIRST_SIDE, parse: state_protocol_1.StateUtil.string };
|
|
60
|
+
exports.SIDEBAR = { key: 'sidebar', initial: 300, min: 200, max: 520 };
|
|
61
|
+
exports.EDITOR = { key: 'editor', initial: 480, min: 320, max: 1200 };
|
|
62
|
+
/** The width of the navigation rail, in style.ts. */
|
|
63
|
+
exports.RAIL = 56;
|
|
64
|
+
/** Whether the workbench on the right shows, in this browser, whose screen decides. */
|
|
65
|
+
const RIGHT = { key: 'panel', tier: 'device', initial: true, parse: state_protocol_1.StateUtil.boolean };
|
|
66
|
+
/** Sessions change with other clients too; while the tab is visible they are read again now and then. */
|
|
67
|
+
const REFRESH_MS = 5000;
|
|
68
|
+
/** The cards of web extensions, as a tool of the workbench and its tab. */
|
|
69
|
+
exports.CARDS_ID = 'ta/cards';
|
|
70
|
+
const CARDS_TAB_ID = `view:${exports.CARDS_ID}`;
|
|
71
|
+
function cardsTab(title) {
|
|
72
|
+
return { id: CARDS_TAB_ID, extension: 'ta', title, icon: lucide_react_1.LayoutGrid, render: editor_area_1.WorkbenchCards };
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Whether the right of the page (editors and cards) shows; on narrow screens it starts hidden. The last of
|
|
76
|
+
* them hides it where it lies over the conversation, the user's choice kept.
|
|
77
|
+
*/
|
|
78
|
+
function useRight() {
|
|
79
|
+
const [kept, keep] = (0, hooks_1.usePersisted)(RIGHT);
|
|
80
|
+
// Where it does not fit beside the conversation it opens over it: only when asked, in this page.
|
|
81
|
+
const inline = (0, device_1.useDevice)(device => device.layout) === 'expanded';
|
|
82
|
+
const [asked, setAsked] = React.useState(false);
|
|
83
|
+
const open = kept && (inline || asked);
|
|
84
|
+
const set = React.useCallback((next) => {
|
|
85
|
+
setAsked(next);
|
|
86
|
+
keep(next);
|
|
87
|
+
}, [keep]);
|
|
88
|
+
const toggle = React.useCallback(() => set(!open), [set, open]);
|
|
89
|
+
const reveal = React.useCallback(() => set(true), [set]);
|
|
90
|
+
const uncover = React.useCallback(() => setAsked(false), []);
|
|
91
|
+
// `set` is stable, so `reveal` is too: effects may depend on it.
|
|
92
|
+
return [open, toggle, reveal, uncover];
|
|
93
|
+
}
|
|
94
|
+
/** Cmd/Ctrl+B shows or hides the sidebar and Cmd/Ctrl+, opens the settings, as in an IDE. */
|
|
95
|
+
function useKeys(toggle, openSettings) {
|
|
96
|
+
React.useEffect(() => {
|
|
97
|
+
const onKey = (event) => {
|
|
98
|
+
if (!(event.metaKey || event.ctrlKey) || event.shiftKey || event.altKey) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const key = event.key.toLowerCase();
|
|
102
|
+
if (key === 'b') {
|
|
103
|
+
event.preventDefault();
|
|
104
|
+
toggle();
|
|
105
|
+
}
|
|
106
|
+
else if (key === ',') {
|
|
107
|
+
event.preventDefault();
|
|
108
|
+
openSettings();
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
window.addEventListener('keydown', onKey);
|
|
112
|
+
return () => window.removeEventListener('keydown', onKey);
|
|
113
|
+
}, [toggle, openSettings]);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The installed app with its title bar hidden draws the bar itself (see .ta-titlebar), but the browser
|
|
117
|
+
* paints the corners of the window's buttons with theme-color: the traffic lights at the left over the
|
|
118
|
+
* side columns, its own buttons at the right. So the bar is the colour of the side columns throughout, the
|
|
119
|
+
* conversation below it too. Otherwise the whole title bar has the conversation's colour, as the sign-in page.
|
|
120
|
+
*/
|
|
121
|
+
function useTitlebarColor(signedIn, theme) {
|
|
122
|
+
React.useEffect(() => {
|
|
123
|
+
const overlay = matchMedia('(display-mode: window-controls-overlay)');
|
|
124
|
+
const apply = () => {
|
|
125
|
+
const meta = document.querySelector('meta[name="theme-color"]');
|
|
126
|
+
if (meta) {
|
|
127
|
+
meta.content = settings_1.THEME_COLORS[theme][overlay.matches && signedIn ? 'side' : 'main'];
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
apply();
|
|
131
|
+
overlay.addEventListener('change', apply);
|
|
132
|
+
return () => overlay.removeEventListener('change', apply);
|
|
133
|
+
}, [signedIn, theme]);
|
|
134
|
+
}
|
|
135
|
+
/** Reads the open sessions and the web extensions again while the tab is visible: other clients change them too. */
|
|
136
|
+
function useRefresh(online) {
|
|
137
|
+
const [, workbench] = (0, hooks_1.useWorkbench)();
|
|
138
|
+
const [, extensions] = (0, hooks_1.useWebExtensions)();
|
|
139
|
+
React.useEffect(() => {
|
|
140
|
+
if (!online) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const sessions = () => document.visibilityState === 'visible' && workbench.refresh().catch(() => undefined);
|
|
144
|
+
const shown = () => {
|
|
145
|
+
sessions();
|
|
146
|
+
if (document.visibilityState === 'visible') {
|
|
147
|
+
extensions.refresh().catch(() => undefined);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const timer = setInterval(sessions, REFRESH_MS);
|
|
151
|
+
document.addEventListener('visibilitychange', shown);
|
|
152
|
+
return () => {
|
|
153
|
+
clearInterval(timer);
|
|
154
|
+
document.removeEventListener('visibilitychange', shown);
|
|
155
|
+
};
|
|
156
|
+
}, [online, workbench, extensions]);
|
|
157
|
+
}
|
|
158
|
+
/** The drawer of a compact layout comes out from the left edge under the finger, and goes the same way. */
|
|
159
|
+
function useDrawerSwipe(enabled, open, setOpen) {
|
|
160
|
+
(0, sheet_swipe_1.useSheetSwipe)({
|
|
161
|
+
enabled,
|
|
162
|
+
open,
|
|
163
|
+
setOpen,
|
|
164
|
+
side: 'left',
|
|
165
|
+
opensFrom: 'edge',
|
|
166
|
+
closesFrom: 'anywhere',
|
|
167
|
+
sheet: '.ta-nav',
|
|
168
|
+
scrim: '.ta-scrim',
|
|
169
|
+
settleMs: 240,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The cards of web extensions as a tool of the workbench and its tab: the tab opens when the first card
|
|
174
|
+
* comes while the workbench `shown` has nothing else open, and goes with the last card.
|
|
175
|
+
*/
|
|
176
|
+
function useWorkbenchCards(shown) {
|
|
177
|
+
const [extensions, host] = (0, hooks_1.useWebExtensions)();
|
|
178
|
+
const [, settingsStore] = (0, hooks_1.useSettings)();
|
|
179
|
+
// The cards of web extensions are a tab of the workbench: it opens when the first card comes, if nothing else is open there, and goes with the last.
|
|
180
|
+
const hasCards = extensions.widgets.some(widget => widget.placement === 'panel');
|
|
181
|
+
const cardsOpen = extensions.editors.some(candidate => candidate.id === CARDS_TAB_ID);
|
|
182
|
+
const openCards = React.useCallback(() => host.open(cardsTab(() => (0, messages_1.message)(settingsStore.state.language, 'ta.workbench.cards'))), [host, settingsStore]);
|
|
183
|
+
const quiet = extensions.editors.length === 0 && shown;
|
|
184
|
+
// Only when cards come: not when the user closes their tab.
|
|
185
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: follows whether there are cards
|
|
186
|
+
React.useEffect(() => {
|
|
187
|
+
if (hasCards && !cardsOpen && quiet) {
|
|
188
|
+
openCards();
|
|
189
|
+
}
|
|
190
|
+
}, [hasCards]);
|
|
191
|
+
React.useEffect(() => {
|
|
192
|
+
if (!hasCards && cardsOpen) {
|
|
193
|
+
void host.closeEditor(CARDS_TAB_ID);
|
|
194
|
+
}
|
|
195
|
+
}, [hasCards, cardsOpen, host]);
|
|
196
|
+
const cardsTool = {
|
|
197
|
+
id: exports.CARDS_ID,
|
|
198
|
+
extension: 'ta',
|
|
199
|
+
title: () => (0, messages_1.message)(settingsStore.state.language, 'ta.workbench.cards'),
|
|
200
|
+
component: editor_area_1.WorkbenchCards,
|
|
201
|
+
icon: lucide_react_1.LayoutGrid,
|
|
202
|
+
location: 'panel',
|
|
203
|
+
order: 0,
|
|
204
|
+
};
|
|
205
|
+
return { hasCards, openCards, cardsTool };
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=app-shell-hooks.js.map
|
|
@@ -41,15 +41,12 @@ const chat_protocol_1 = require("../chat/chat-protocol");
|
|
|
41
41
|
const chat_view_1 = require("../chat/chat-view");
|
|
42
42
|
const device_1 = require("../device/device");
|
|
43
43
|
const launch_screen_1 = require("../device/launch-screen");
|
|
44
|
-
const sheet_swipe_1 = require("../device/sheet-swipe");
|
|
45
44
|
const extension_view_1 = require("../extension/extension-view");
|
|
46
45
|
const hooks_1 = require("../hooks");
|
|
47
|
-
const messages_1 = require("../i18n/messages");
|
|
48
46
|
const use_t_1 = require("../i18n/use-t");
|
|
49
47
|
const notices_1 = require("../notices/notices");
|
|
50
|
-
const settings_1 = require("../settings/settings");
|
|
51
|
-
const state_protocol_1 = require("../state/state-protocol");
|
|
52
48
|
const app_nav_1 = require("./app-nav");
|
|
49
|
+
const app_shell_hooks_1 = require("./app-shell-hooks");
|
|
53
50
|
const auth_view_1 = require("./auth-view");
|
|
54
51
|
const board_1 = require("./board");
|
|
55
52
|
const chat_list_1 = require("./chat-list");
|
|
@@ -77,112 +74,6 @@ const split_pane_1 = require("./split-pane");
|
|
|
77
74
|
const surface_flyout_1 = require("./surface-flyout");
|
|
78
75
|
const workbench_toggle_1 = require("./workbench-toggle");
|
|
79
76
|
const workbench_view_1 = require("./workbench-view");
|
|
80
|
-
/**
|
|
81
|
-
* What the sidebar shows in this tab: `` for the chats, else the id of a sidebar view. Until the user picks
|
|
82
|
-
* a tab, the first sidebar view of web extensions (the agents), or the chats if there is none.
|
|
83
|
-
*/
|
|
84
|
-
const FIRST_SIDE = '*';
|
|
85
|
-
/** The user put off signing in to a model, in this tab: the page shows the app until the tab is reopened. */
|
|
86
|
-
const LOGIN_LATER = { key: 'login.later', tier: 'tab', initial: false, parse: state_protocol_1.StateUtil.boolean };
|
|
87
|
-
const SIDE = { key: 'side', tier: 'tab', initial: FIRST_SIDE, parse: state_protocol_1.StateUtil.string };
|
|
88
|
-
/** Whether the workbench on the right shows, in this browser, whose screen decides. */
|
|
89
|
-
const RIGHT = { key: 'panel', tier: 'device', initial: true, parse: state_protocol_1.StateUtil.boolean };
|
|
90
|
-
/** Sessions change with other clients too; while the tab is visible they are read again now and then. */
|
|
91
|
-
const REFRESH_MS = 5000;
|
|
92
|
-
/** The cards of web extensions, as a tool of the workbench and its tab. */
|
|
93
|
-
const CARDS_ID = 'ta/cards';
|
|
94
|
-
const CARDS_TAB_ID = `view:${CARDS_ID}`;
|
|
95
|
-
function cardsTab(title) {
|
|
96
|
-
return { id: CARDS_TAB_ID, extension: 'ta', title, icon: lucide_react_1.LayoutGrid, render: editor_area_1.WorkbenchCards };
|
|
97
|
-
}
|
|
98
|
-
const SIDEBAR = { key: 'sidebar', initial: 300, min: 200, max: 520 };
|
|
99
|
-
const EDITOR = { key: 'editor', initial: 480, min: 320, max: 1200 };
|
|
100
|
-
/** The width of the navigation rail, in style.ts. */
|
|
101
|
-
const RAIL = 56;
|
|
102
|
-
/**
|
|
103
|
-
* Whether the right of the page (editors and cards) shows; on narrow screens it starts hidden. The last of
|
|
104
|
-
* them hides it where it lies over the conversation, the user's choice kept.
|
|
105
|
-
*/
|
|
106
|
-
function useRight() {
|
|
107
|
-
const [kept, keep] = (0, hooks_1.usePersisted)(RIGHT);
|
|
108
|
-
// Where it does not fit beside the conversation it opens over it: only when asked, in this page.
|
|
109
|
-
const inline = (0, device_1.useDevice)(device => device.layout) === 'expanded';
|
|
110
|
-
const [asked, setAsked] = React.useState(false);
|
|
111
|
-
const open = kept && (inline || asked);
|
|
112
|
-
const set = React.useCallback((next) => {
|
|
113
|
-
setAsked(next);
|
|
114
|
-
keep(next);
|
|
115
|
-
}, [keep]);
|
|
116
|
-
const toggle = React.useCallback(() => set(!open), [set, open]);
|
|
117
|
-
const reveal = React.useCallback(() => set(true), [set]);
|
|
118
|
-
const uncover = React.useCallback(() => setAsked(false), []);
|
|
119
|
-
// `set` is stable, so `reveal` is too: effects may depend on it.
|
|
120
|
-
return [open, toggle, reveal, uncover];
|
|
121
|
-
}
|
|
122
|
-
/** Cmd/Ctrl+B shows or hides the sidebar and Cmd/Ctrl+, opens the settings, as in an IDE. */
|
|
123
|
-
function useKeys(toggle, openSettings) {
|
|
124
|
-
React.useEffect(() => {
|
|
125
|
-
const onKey = (event) => {
|
|
126
|
-
if (!(event.metaKey || event.ctrlKey) || event.shiftKey || event.altKey) {
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
const key = event.key.toLowerCase();
|
|
130
|
-
if (key === 'b') {
|
|
131
|
-
event.preventDefault();
|
|
132
|
-
toggle();
|
|
133
|
-
}
|
|
134
|
-
else if (key === ',') {
|
|
135
|
-
event.preventDefault();
|
|
136
|
-
openSettings();
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
window.addEventListener('keydown', onKey);
|
|
140
|
-
return () => window.removeEventListener('keydown', onKey);
|
|
141
|
-
}, [toggle, openSettings]);
|
|
142
|
-
}
|
|
143
|
-
/** Reads the open sessions and the web extensions again while the tab is visible: other clients change them too. */
|
|
144
|
-
/**
|
|
145
|
-
* The installed app with its title bar hidden draws the bar itself (see .ta-titlebar), but the browser
|
|
146
|
-
* paints the corners of the window's buttons with theme-color: the traffic lights at the left over the
|
|
147
|
-
* side columns, its own buttons at the right. So the bar is the colour of the side columns throughout, the
|
|
148
|
-
* conversation below it too. Otherwise the whole title bar has the conversation's colour, as the sign-in page.
|
|
149
|
-
*/
|
|
150
|
-
function useTitlebarColor(signedIn, theme) {
|
|
151
|
-
React.useEffect(() => {
|
|
152
|
-
const overlay = matchMedia('(display-mode: window-controls-overlay)');
|
|
153
|
-
const apply = () => {
|
|
154
|
-
const meta = document.querySelector('meta[name="theme-color"]');
|
|
155
|
-
if (meta) {
|
|
156
|
-
meta.content = settings_1.THEME_COLORS[theme][overlay.matches && signedIn ? 'side' : 'main'];
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
apply();
|
|
160
|
-
overlay.addEventListener('change', apply);
|
|
161
|
-
return () => overlay.removeEventListener('change', apply);
|
|
162
|
-
}, [signedIn, theme]);
|
|
163
|
-
}
|
|
164
|
-
function useRefresh(online) {
|
|
165
|
-
const [, workbench] = (0, hooks_1.useWorkbench)();
|
|
166
|
-
const [, extensions] = (0, hooks_1.useWebExtensions)();
|
|
167
|
-
React.useEffect(() => {
|
|
168
|
-
if (!online) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
const sessions = () => document.visibilityState === 'visible' && workbench.refresh().catch(() => undefined);
|
|
172
|
-
const shown = () => {
|
|
173
|
-
sessions();
|
|
174
|
-
if (document.visibilityState === 'visible') {
|
|
175
|
-
extensions.refresh().catch(() => undefined);
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
const timer = setInterval(sessions, REFRESH_MS);
|
|
179
|
-
document.addEventListener('visibilitychange', shown);
|
|
180
|
-
return () => {
|
|
181
|
-
clearInterval(timer);
|
|
182
|
-
document.removeEventListener('visibilitychange', shown);
|
|
183
|
-
};
|
|
184
|
-
}, [online, workbench, extensions]);
|
|
185
|
-
}
|
|
186
77
|
/**
|
|
187
78
|
* ta on the web, laid out as an IDE: the navigation, a sidebar (the chats, or a sidebar view of a web
|
|
188
79
|
* extension), the conversation or a page, the workbench (the tools of web extensions and the tabs they
|
|
@@ -197,7 +88,7 @@ function AppShell() {
|
|
|
197
88
|
const [workbench, bench] = (0, hooks_1.useWorkbench)();
|
|
198
89
|
const [extensions, host] = (0, hooks_1.useWebExtensions)();
|
|
199
90
|
const [{ store, pending }, chat] = (0, chat_view_1.useChat)();
|
|
200
|
-
const [sideId, setSideId] = (0, hooks_1.usePersisted)(SIDE);
|
|
91
|
+
const [sideId, setSideId] = (0, hooks_1.usePersisted)(app_shell_hooks_1.SIDE);
|
|
201
92
|
const [removedChats] = (0, hooks_1.usePersisted)(chat_protocol_1.REMOVED_CHATS);
|
|
202
93
|
const [chatsByDirectory, setChatsByDirectory] = (0, hooks_1.usePersisted)(chat_list_1.BY_DIRECTORY);
|
|
203
94
|
const [foldedChats, setFoldedChats] = (0, hooks_1.usePersisted)(chat_list_1.FOLDED);
|
|
@@ -216,7 +107,7 @@ function AppShell() {
|
|
|
216
107
|
React.useEffect(() => {
|
|
217
108
|
if (phone && !opened.current) {
|
|
218
109
|
opened.current = true;
|
|
219
|
-
setSideId(FIRST_SIDE);
|
|
110
|
+
setSideId(app_shell_hooks_1.FIRST_SIDE);
|
|
220
111
|
host.showPage('');
|
|
221
112
|
}
|
|
222
113
|
}, [phone, setSideId, host]);
|
|
@@ -236,17 +127,17 @@ function AppShell() {
|
|
|
236
127
|
}, [phone]);
|
|
237
128
|
const closeSettings = React.useCallback(() => (phone ? setScreenOpen(false) : setSettings(undefined)), [phone]);
|
|
238
129
|
const settingsShown = settings !== undefined && (!phone || screenOpen);
|
|
239
|
-
const [rightOpen, toggleRight, revealRight, uncoverRight] = useRight();
|
|
130
|
+
const [rightOpen, toggleRight, revealRight, uncoverRight] = (0, app_shell_hooks_1.useRight)();
|
|
240
131
|
const [maximized, setMaximized] = React.useState(false);
|
|
241
|
-
const [{ theme, language }
|
|
242
|
-
const sidebar = (0, split_pane_1.usePane)(SIDEBAR);
|
|
243
|
-
const editor = (0, split_pane_1.usePane)(EDITOR);
|
|
132
|
+
const [{ theme, language }] = (0, hooks_1.useSettings)();
|
|
133
|
+
const sidebar = (0, split_pane_1.usePane)(app_shell_hooks_1.SIDEBAR);
|
|
134
|
+
const editor = (0, split_pane_1.usePane)(app_shell_hooks_1.EDITOR);
|
|
244
135
|
const online = workbench.status === 'online';
|
|
245
136
|
// Files named in replies outside a conversation (channels, pages) are in the server's directory.
|
|
246
137
|
const fileUrl = React.useCallback((path) => bench.workspace.fileUrl(path), [bench]);
|
|
247
138
|
const openLink = (0, hooks_1.useOpenLink)(undefined);
|
|
248
139
|
(0, workbench_view_1.useDocument)();
|
|
249
|
-
useRefresh(online);
|
|
140
|
+
(0, app_shell_hooks_1.useRefresh)(online);
|
|
250
141
|
// What the server and its packages say (errors, questions) is in the language of the page.
|
|
251
142
|
React.useEffect(() => {
|
|
252
143
|
if (online) {
|
|
@@ -324,35 +215,10 @@ function AppShell() {
|
|
|
324
215
|
setSideId('');
|
|
325
216
|
}
|
|
326
217
|
}, [shownSession]);
|
|
327
|
-
|
|
328
|
-
const hasCards = extensions.widgets.some(widget => widget.placement === 'panel');
|
|
329
|
-
const cardsOpen = extensions.editors.some(candidate => candidate.id === CARDS_TAB_ID);
|
|
330
|
-
const openCards = React.useCallback(() => host.open(cardsTab(() => (0, messages_1.message)(settingsStore.state.language, 'ta.workbench.cards'))), [host, settingsStore]);
|
|
331
|
-
const quiet = extensions.editors.length === 0 && rightOpen && !editor.collapsed;
|
|
332
|
-
// Only when cards come: not when the user closes their tab.
|
|
333
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: follows whether there are cards
|
|
334
|
-
React.useEffect(() => {
|
|
335
|
-
if (hasCards && !cardsOpen && quiet) {
|
|
336
|
-
openCards();
|
|
337
|
-
}
|
|
338
|
-
}, [hasCards]);
|
|
339
|
-
React.useEffect(() => {
|
|
340
|
-
if (!hasCards && cardsOpen) {
|
|
341
|
-
void host.closeEditor(CARDS_TAB_ID);
|
|
342
|
-
}
|
|
343
|
-
}, [hasCards, cardsOpen, host]);
|
|
344
|
-
const cardsTool = {
|
|
345
|
-
id: CARDS_ID,
|
|
346
|
-
extension: 'ta',
|
|
347
|
-
title: () => (0, messages_1.message)(settingsStore.state.language, 'ta.workbench.cards'),
|
|
348
|
-
component: editor_area_1.WorkbenchCards,
|
|
349
|
-
icon: lucide_react_1.LayoutGrid,
|
|
350
|
-
location: 'panel',
|
|
351
|
-
order: 0,
|
|
352
|
-
};
|
|
218
|
+
const { hasCards, openCards, cardsTool } = (0, app_shell_hooks_1.useWorkbenchCards)(rightOpen && !editor.collapsed);
|
|
353
219
|
const view = extensions.views.find(candidate => candidate.id === page && candidate.location === 'page');
|
|
354
220
|
const sideViews = side_lists_1.SideListUtil.sidebarViews(extensions.views);
|
|
355
|
-
const sideView = sideId === FIRST_SIDE ? sideViews[0] : sideViews.find(candidate => candidate.id === sideId);
|
|
221
|
+
const sideView = sideId === app_shell_hooks_1.FIRST_SIDE ? sideViews[0] : sideViews.find(candidate => candidate.id === sideId);
|
|
356
222
|
const side = sideView ? sideView.id : '';
|
|
357
223
|
const showPage = (id) => {
|
|
358
224
|
host.showPage(id);
|
|
@@ -362,7 +228,7 @@ function AppShell() {
|
|
|
362
228
|
};
|
|
363
229
|
const lists = side_lists_1.SideListUtil.of(sideViews, t('ta.chat'));
|
|
364
230
|
const tools = [...(hasCards ? [cardsTool] : []), ...extensions.views.filter(candidate => candidate.location === 'panel')];
|
|
365
|
-
const openTool = (id) => (id === CARDS_ID ? openCards() : host.openView(id));
|
|
231
|
+
const openTool = (id) => (id === app_shell_hooks_1.CARDS_ID ? openCards() : host.openView(id));
|
|
366
232
|
// The workbench: the tabs open, or the tools that open there.
|
|
367
233
|
const editors = extensions.editors.length > 0 || tools.length > 0;
|
|
368
234
|
// The settings take the place of the conversation and of the workbench, as a page of their own.
|
|
@@ -376,18 +242,7 @@ function AppShell() {
|
|
|
376
242
|
}
|
|
377
243
|
tabsBefore.current = tabCount;
|
|
378
244
|
}, [tabCount, showEditors, toggleRight, layout]);
|
|
379
|
-
|
|
380
|
-
(0, sheet_swipe_1.useSheetSwipe)({
|
|
381
|
-
enabled: touch && layout === 'compact' && !phone && !showEditors,
|
|
382
|
-
open: navOpen,
|
|
383
|
-
setOpen: setNavOpen,
|
|
384
|
-
side: 'left',
|
|
385
|
-
opensFrom: 'edge',
|
|
386
|
-
closesFrom: 'anywhere',
|
|
387
|
-
sheet: '.ta-nav',
|
|
388
|
-
scrim: '.ta-scrim',
|
|
389
|
-
settleMs: 240,
|
|
390
|
-
});
|
|
245
|
+
(0, app_shell_hooks_1.useDrawerSwipe)(touch && layout === 'compact' && !phone && !showEditors, navOpen, setNavOpen);
|
|
391
246
|
// The pages of the rail: in the navigation, or under Discover.
|
|
392
247
|
const navigation = (0, app_nav_1.useNavigation)(extensions.views);
|
|
393
248
|
// Without a sidebar view that lists the double, its page is the first tab: it opens there, once the views are in.
|
|
@@ -467,10 +322,10 @@ function AppShell() {
|
|
|
467
322
|
sidebar.reveal();
|
|
468
323
|
}
|
|
469
324
|
};
|
|
470
|
-
useKeys(toggleSide, openSettings);
|
|
471
|
-
useTitlebarColor(workbench.status !== 'signed-out', theme);
|
|
325
|
+
(0, app_shell_hooks_1.useKeys)(toggleSide, openSettings);
|
|
326
|
+
(0, app_shell_hooks_1.useTitlebarColor)(workbench.status !== 'signed-out', theme);
|
|
472
327
|
const [providers, reloadProviders] = (0, auth_view_1.useAuthProviders)(online);
|
|
473
|
-
const [later, setLater] = (0, hooks_1.usePersisted)(LOGIN_LATER);
|
|
328
|
+
const [later, setLater] = (0, hooks_1.usePersisted)(app_shell_hooks_1.LOGIN_LATER);
|
|
474
329
|
/** A call failed for want of a sign-in (SIGN_IN_EVENT): the page of sign-in, even if the user put it off. */
|
|
475
330
|
const [asked, setAsked] = React.useState(false);
|
|
476
331
|
React.useEffect(() => {
|
|
@@ -507,7 +362,7 @@ function AppShell() {
|
|
|
507
362
|
};
|
|
508
363
|
// What the columns beside the conversation and the editors take, so that the editors never take more than the conversation.
|
|
509
364
|
const sideWidths = {
|
|
510
|
-
'--ta-left': `${RAIL + (sideShown ? sidebar.size : 0)}px`,
|
|
365
|
+
'--ta-left': `${app_shell_hooks_1.RAIL + (sideShown ? sidebar.size : 0)}px`,
|
|
511
366
|
};
|
|
512
367
|
const classes = ['ta-app', navOpen && 'ta-nav-open', showEditors && 'ta-editors-open', showEditors && maximized && 'ta-workbench-max'];
|
|
513
368
|
const toggle = editors ? { open: showEditors, toggle: toggleWorkbench, tabs: extensions.editors.length } : undefined;
|
|
@@ -43,7 +43,7 @@ const React = __importStar(require("react"));
|
|
|
43
43
|
const react_dom_1 = require("react-dom");
|
|
44
44
|
const hooks_1 = require("../hooks");
|
|
45
45
|
const use_t_1 = require("../i18n/use-t");
|
|
46
|
-
const
|
|
46
|
+
const workbench_util_1 = require("../workbench-util");
|
|
47
47
|
const auth_pictures_1 = require("./auth-pictures");
|
|
48
48
|
const callout_1 = require("./callout");
|
|
49
49
|
const empty_state_1 = require("./empty-state");
|
|
@@ -126,7 +126,7 @@ function AuthFlow({ provider, onDone, onBack }) {
|
|
|
126
126
|
const t = (0, use_t_1.useT)();
|
|
127
127
|
const [workbench, bench] = (0, hooks_1.useWorkbench)();
|
|
128
128
|
// The provider sends the browser back to the machine of ta serve, which is not this one: the address is pasted.
|
|
129
|
-
const elsewhere =
|
|
129
|
+
const elsewhere = workbench_util_1.WorkbenchUtil.elsewhere(workbench.host);
|
|
130
130
|
const [state, dispatch] = React.useReducer(AuthUtil.reduce, { infos: [] });
|
|
131
131
|
const [answer, setAnswer] = React.useState('');
|
|
132
132
|
const loginId = React.useRef(undefined);
|
|
@@ -339,7 +339,7 @@ function LoginPage({ onLater, onSignedIn }) {
|
|
|
339
339
|
React.createElement("div", { className: "ta-card ta-login-card" },
|
|
340
340
|
React.createElement(ta_avatar_1.TaAvatar, { size: 72 }),
|
|
341
341
|
React.createElement("h1", null, t('ta.auth.title')),
|
|
342
|
-
React.createElement("p", null, t(
|
|
342
|
+
React.createElement("p", null, t(workbench_util_1.WorkbenchUtil.elsewhere(workbench.host) ? 'ta.auth.hintRemote' : 'ta.auth.hint')),
|
|
343
343
|
React.createElement(AuthPanel, { kinds: true, onSignedIn: onSignedIn }),
|
|
344
344
|
React.createElement("button", { type: "button", className: "ta-login-later", onClick: onLater }, t('ta.auth.later')))));
|
|
345
345
|
}
|
|
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.Composer = void 0;
|
|
37
37
|
const lucide_react_1 = require("lucide-react");
|
|
38
38
|
const React = __importStar(require("react"));
|
|
39
|
+
const assistant_task_util_1 = require("../assistant/assistant-task-util");
|
|
39
40
|
const device_1 = require("../device/device");
|
|
40
41
|
const use_t_1 = require("../i18n/use-t");
|
|
41
42
|
const composer_1 = require("../util/composer");
|
|
@@ -44,6 +45,8 @@ const icon_1 = require("./icon");
|
|
|
44
45
|
const FILE_LIMIT = 20;
|
|
45
46
|
const FILE_DELAY_MS = 120;
|
|
46
47
|
const EMPTY_QUEUE = { steering: [], followUp: [] };
|
|
48
|
+
/** What the user said of what waited: not the notes of the tasks that ended, which they did not write. */
|
|
49
|
+
const said = (texts) => texts.filter(text => !assistant_task_util_1.AssistantTaskUtil.noteOf(text));
|
|
47
50
|
/** The files for an `@` being typed; a server without file search answers with an error, and the menu says so. */
|
|
48
51
|
function useFiles(workspace, cwd, query) {
|
|
49
52
|
const t = (0, use_t_1.useT)();
|
|
@@ -120,7 +123,7 @@ exports.Composer = React.forwardRef(function Composer(props, ref) {
|
|
|
120
123
|
server.clearQueue(store.sessionId).then(taken => {
|
|
121
124
|
var _a;
|
|
122
125
|
setQueue(EMPTY_QUEUE);
|
|
123
|
-
(_a = box.current) === null || _a === void 0 ? void 0 : _a.setText(composer_1.ComposerUtil.restore(taken, box.current.text()));
|
|
126
|
+
(_a = box.current) === null || _a === void 0 ? void 0 : _a.setText(composer_1.ComposerUtil.restore({ steering: said(taken.steering), followUp: said(taken.followUp) }, box.current.text()));
|
|
124
127
|
}, onError);
|
|
125
128
|
};
|
|
126
129
|
/** Takes one message out; into the box when `back`. */
|
|
@@ -143,14 +146,18 @@ exports.Composer = React.forwardRef(function Composer(props, ref) {
|
|
|
143
146
|
React.createElement("div", { className: "ta-queue-head" },
|
|
144
147
|
React.createElement("span", null, t('ta.composer.queue.count', { count: waiting.length })),
|
|
145
148
|
React.createElement("button", { type: "button", className: "ta-queue-all", onClick: takeBack, title: t('ta.composer.queue.takeBackTitle') }, t('ta.composer.queue.takeBackAll'))),
|
|
146
|
-
waiting.map(entry =>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
React.createElement("
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
React.createElement("
|
|
154
|
-
React.createElement(
|
|
149
|
+
waiting.map(entry => {
|
|
150
|
+
const note = assistant_task_util_1.AssistantTaskUtil.noteOf(entry.text);
|
|
151
|
+
const text = note ? t('ta.task.ended', { title: note.title, status: t(`ta.task.${note.status}`) }) : entry.text;
|
|
152
|
+
return (React.createElement("div", { key: `${entry.kind}-${entry.index}-${entry.text}`, className: "ta-queue-row" },
|
|
153
|
+
React.createElement("span", { className: "ta-queue-kind", title: t(entry.kind === 'steering' ? 'ta.composer.queue.steering' : 'ta.composer.queue.followUp') },
|
|
154
|
+
React.createElement(icon_1.Icon, { icon: entry.kind === 'steering' ? lucide_react_1.CornerDownRight : lucide_react_1.Clock3, size: 13 })),
|
|
155
|
+
React.createElement("span", { className: "ta-ellipsis ta-queue-text", title: text }, text),
|
|
156
|
+
React.createElement("span", { className: "ta-queue-actions" },
|
|
157
|
+
!note && (React.createElement("button", { type: "button", className: "ta-icon-button", onClick: () => remove(entry, true), title: t('ta.composer.queue.editTitle'), "aria-label": t('ta.composer.queue.editTitle') },
|
|
158
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.Undo2, size: 13 }))),
|
|
159
|
+
React.createElement("button", { type: "button", className: "ta-icon-button", onClick: () => remove(entry, false), title: t('ta.composer.queue.remove'), "aria-label": t('ta.composer.queue.remove') },
|
|
160
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.X, size: 13 })))));
|
|
161
|
+
})))) }));
|
|
155
162
|
});
|
|
156
163
|
//# sourceMappingURL=composer.js.map
|