@celljs/ta-web 4.25.0 → 4.26.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.js +3 -1
- package/esm/browser/assistant/assistant-task-source.js +3 -1
- package/esm/browser/assistant/assistant-thread.d.ts +5 -2
- package/esm/browser/assistant/assistant-thread.js +70 -46
- package/esm/browser/assistant/assistant-view.js +9 -3
- package/esm/browser/components/account-menu.d.ts +2 -1
- package/esm/browser/components/account-menu.js +7 -2
- package/esm/browser/components/app-nav.js +5 -5
- package/esm/browser/components/chat-asks.js +16 -1
- package/esm/browser/components/chat-home.d.ts +7 -2
- package/esm/browser/components/chat-home.js +2 -2
- package/esm/browser/components/chat-icon.d.ts +6 -1
- package/esm/browser/components/chat-icon.js +45 -4
- package/esm/browser/components/chat-list-hooks.d.ts +10 -0
- package/esm/browser/components/chat-list-hooks.js +15 -0
- package/esm/browser/components/chat-list.js +7 -9
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/composer-addon-util.d.ts +5 -0
- package/esm/browser/components/composer-addon-util.js +17 -0
- package/esm/browser/components/composer-addons.d.ts +3 -1
- package/esm/browser/components/composer-addons.js +5 -2
- package/esm/browser/components/editor-area.js +2 -2
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/message-footer.d.ts +2 -2
- package/esm/browser/components/message-footer.js +2 -2
- package/esm/browser/components/message-list.d.ts +12 -0
- package/esm/browser/components/message-list.js +31 -18
- package/esm/browser/components/nav-places.d.ts +2 -1
- package/esm/browser/components/nav-places.js +3 -2
- package/esm/browser/components/serve-restart.d.ts +11 -2
- package/esm/browser/components/serve-restart.js +64 -3
- package/esm/browser/components/session-view.js +3 -2
- package/esm/browser/components/settings-more.js +7 -4
- package/esm/browser/extension/extension-view.d.ts +8 -0
- package/esm/browser/extension/extension-view.js +12 -1
- package/esm/browser/extension/icons.js +10 -1
- package/esm/browser/extension/web-api-contributions.d.ts +15 -2
- package/esm/browser/extension/web-api-partners.d.ts +6 -0
- package/esm/browser/extension/web-home.js +8 -0
- package/esm/browser/i18n/locales.d.ts +8 -1
- package/esm/browser/i18n/messages-ja.js +7 -0
- package/esm/browser/i18n/messages-zh-tw.js +7 -0
- package/esm/browser/i18n/messages.d.ts +7 -0
- package/esm/browser/i18n/messages.js +14 -0
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation-column.js +2 -2
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +7 -4
- package/esm/browser/style/tasks.d.ts +1 -1
- package/esm/browser/style/tasks.js +1 -1
- package/esm/browser/workbench-protocol.d.ts +5 -0
- package/esm/browser/workbench.d.ts +1 -0
- package/esm/browser/workbench.js +20 -0
- package/lib/browser/account/account-side.js +3 -1
- package/lib/browser/assistant/assistant-task-source.js +3 -1
- package/lib/browser/assistant/assistant-thread.d.ts +5 -2
- package/lib/browser/assistant/assistant-thread.js +70 -46
- package/lib/browser/assistant/assistant-view.js +8 -2
- package/lib/browser/components/account-menu.d.ts +2 -1
- package/lib/browser/components/account-menu.js +6 -1
- package/lib/browser/components/app-nav.js +4 -4
- package/lib/browser/components/chat-asks.js +16 -1
- package/lib/browser/components/chat-home.d.ts +7 -2
- package/lib/browser/components/chat-home.js +2 -2
- package/lib/browser/components/chat-icon.d.ts +6 -1
- package/lib/browser/components/chat-icon.js +45 -4
- package/lib/browser/components/chat-list-hooks.d.ts +10 -0
- package/lib/browser/components/chat-list-hooks.js +16 -0
- package/lib/browser/components/chat-list.js +6 -8
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/composer-addon-util.d.ts +5 -0
- package/lib/browser/components/composer-addon-util.js +17 -0
- package/lib/browser/components/composer-addons.d.ts +3 -1
- package/lib/browser/components/composer-addons.js +5 -2
- package/lib/browser/components/editor-area.js +1 -1
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/message-footer.d.ts +2 -2
- package/lib/browser/components/message-footer.js +3 -4
- package/lib/browser/components/message-list.d.ts +12 -0
- package/lib/browser/components/message-list.js +32 -18
- package/lib/browser/components/nav-places.d.ts +2 -1
- package/lib/browser/components/nav-places.js +3 -2
- package/lib/browser/components/serve-restart.d.ts +11 -2
- package/lib/browser/components/serve-restart.js +64 -3
- package/lib/browser/components/session-view.js +3 -2
- package/lib/browser/components/settings-more.js +7 -4
- package/lib/browser/extension/extension-view.d.ts +8 -0
- package/lib/browser/extension/extension-view.js +12 -0
- package/lib/browser/extension/icons.js +9 -0
- package/lib/browser/extension/web-api-contributions.d.ts +15 -2
- package/lib/browser/extension/web-api-partners.d.ts +6 -0
- package/lib/browser/extension/web-home.js +8 -0
- package/lib/browser/i18n/locales.d.ts +8 -1
- package/lib/browser/i18n/messages-ja.js +7 -0
- package/lib/browser/i18n/messages-zh-tw.js +7 -0
- package/lib/browser/i18n/messages.d.ts +7 -0
- package/lib/browser/i18n/messages.js +14 -0
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation-column.js +2 -2
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +7 -4
- package/lib/browser/style/tasks.d.ts +1 -1
- package/lib/browser/style/tasks.js +1 -1
- package/lib/browser/workbench-protocol.d.ts +5 -0
- package/lib/browser/workbench.d.ts +1 -0
- package/lib/browser/workbench.js +20 -0
- package/package.json +7 -7
|
@@ -29,9 +29,9 @@ export declare function useTimeLabel(): (timestamp: number) => string;
|
|
|
29
29
|
* The time between two messages far apart (ProcessUtil.timeBreaks), as WeChat shows it: on a touch screen,
|
|
30
30
|
* where the footers of the messages, which carry their times, are not shown.
|
|
31
31
|
*/
|
|
32
|
-
export declare
|
|
32
|
+
export declare const TimeBreak: React.MemoExoticComponent<({ timestamp }: {
|
|
33
33
|
timestamp?: number;
|
|
34
|
-
})
|
|
34
|
+
}) => React.JSX.Element>;
|
|
35
35
|
/** Above the first turn of another model (ProcessUtil.modelBreaks): the conversation goes on with it. */
|
|
36
36
|
export declare function ModelBreak({ model }: {
|
|
37
37
|
model: string;
|
|
@@ -62,9 +62,9 @@ function Time({ timestamp, className = 'ta-footer-time' }) {
|
|
|
62
62
|
* The time between two messages far apart (ProcessUtil.timeBreaks), as WeChat shows it: on a touch screen,
|
|
63
63
|
* where the footers of the messages, which carry their times, are not shown.
|
|
64
64
|
*/
|
|
65
|
-
export function TimeBreak({ timestamp }) {
|
|
65
|
+
export const TimeBreak = React.memo(function TimeBreak({ timestamp }) {
|
|
66
66
|
return React.createElement(Time, { timestamp: timestamp, className: "ta-time-break" });
|
|
67
|
-
}
|
|
67
|
+
});
|
|
68
68
|
/** Above the first turn of another model (ProcessUtil.modelBreaks): the conversation goes on with it. */
|
|
69
69
|
export function ModelBreak({ model }) {
|
|
70
70
|
const t = useT();
|
|
@@ -19,6 +19,18 @@ export declare function quiet(item: ThreadItem | undefined): boolean;
|
|
|
19
19
|
* again when the words under the steps go into them, and it stayed out of line until something else drew.
|
|
20
20
|
*/
|
|
21
21
|
export declare function endsInSteps(item: ThreadItem | undefined): boolean;
|
|
22
|
+
/** Which rows of a thread are drawn, and the classes of the box of each (.ta-thread-item). */
|
|
23
|
+
export interface ThreadRows {
|
|
24
|
+
/** The first row drawn: those before are held back (RowWindow). */
|
|
25
|
+
from: number;
|
|
26
|
+
className(index: number, extra?: string | false): string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The rows of a thread as a conversation draws them (MessageList, the double's AssistantThread): only the latest
|
|
30
|
+
* `rows.rows` of a long one; those far up neither laid out nor painted until they scroll into view (content-visibility);
|
|
31
|
+
* those that come after it was drawn come in with a motion, and no other.
|
|
32
|
+
*/
|
|
33
|
+
export declare function useThreadRows(items: readonly ThreadItem[], rows?: RowWindow): ThreadRows;
|
|
22
34
|
/** The conversation; tool results show with the calls they answer. `rows`: only its latest rows are drawn, more as asked. */
|
|
23
35
|
export declare function MessageList({ state, outbox, rows }: {
|
|
24
36
|
state: SessionState;
|
|
@@ -195,17 +195,14 @@ function useLaidOut(key) {
|
|
|
195
195
|
}
|
|
196
196
|
/** The last rows, which change and are in view, are always laid out. */
|
|
197
197
|
const SETTLED_AFTER = 4;
|
|
198
|
-
/**
|
|
199
|
-
|
|
198
|
+
/**
|
|
199
|
+
* The rows of a thread as a conversation draws them (MessageList, the double's AssistantThread): only the latest
|
|
200
|
+
* `rows.rows` of a long one; those far up neither laid out nor painted until they scroll into view (content-visibility);
|
|
201
|
+
* those that come after it was drawn come in with a motion, and no other.
|
|
202
|
+
*/
|
|
203
|
+
export function useThreadRows(items, rows) {
|
|
200
204
|
var _a;
|
|
201
205
|
var _b;
|
|
202
|
-
const renderers = React.useContext(MessageRenderers);
|
|
203
|
-
const items = React.useMemo(() => ProcessUtil.items(state.messages, state.working, state.start, renderers, state.head), [state.messages, state.working, state.start, renderers, state.head]);
|
|
204
|
-
const breaks = React.useMemo(() => ProcessUtil.timeBreaks(ProcessUtil.starts(items), index => ProcessUtil.shown(items[index], renderers)), [items, renderers]);
|
|
205
|
-
const models = React.useMemo(() => ProcessUtil.modelBreaks(items), [items]);
|
|
206
|
-
// A turn's cards know what the user said after it: a choice they asked for is made.
|
|
207
|
-
const answers = React.useMemo(() => ProcessUtil.answers(items, message => userWords(MessageUtil.blocks(message)).copied), [items]);
|
|
208
|
-
const sent = React.useMemo(() => { var _a; return ({ of: new Map(((_a = state.outbox) !== null && _a !== void 0 ? _a : []).map(message => [message.message, message])), actions: outbox }); }, [state.outbox, outbox]);
|
|
209
206
|
// The rows held back: those before the latest `rows.rows`.
|
|
210
207
|
const from = rows ? Math.max(0, items.length - rows.rows) : 0;
|
|
211
208
|
if (rows) {
|
|
@@ -221,6 +218,30 @@ export function MessageList({ state, outbox, rows }) {
|
|
|
221
218
|
const freshRows = React.useRef(undefined);
|
|
222
219
|
(_b = freshRows.current) !== null && _b !== void 0 ? _b : (freshRows.current = new FreshRows(items));
|
|
223
220
|
const fresh = freshRows.current.from(items);
|
|
221
|
+
const count = items.length;
|
|
222
|
+
return {
|
|
223
|
+
from,
|
|
224
|
+
className: (index, extra) => [
|
|
225
|
+
'ta-thread-item',
|
|
226
|
+
index >= front && index < count - SETTLED_AFTER && 'ta-settled',
|
|
227
|
+
index === count - 1 && 'ta-thread-last',
|
|
228
|
+
index >= fresh && 'ta-thread-new',
|
|
229
|
+
extra,
|
|
230
|
+
]
|
|
231
|
+
.filter(Boolean)
|
|
232
|
+
.join(' '),
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
/** The conversation; tool results show with the calls they answer. `rows`: only its latest rows are drawn, more as asked. */
|
|
236
|
+
export function MessageList({ state, outbox, rows }) {
|
|
237
|
+
const renderers = React.useContext(MessageRenderers);
|
|
238
|
+
const items = React.useMemo(() => ProcessUtil.items(state.messages, state.working, state.start, renderers, state.head), [state.messages, state.working, state.start, renderers, state.head]);
|
|
239
|
+
const breaks = React.useMemo(() => ProcessUtil.timeBreaks(ProcessUtil.starts(items), index => ProcessUtil.shown(items[index], renderers)), [items, renderers]);
|
|
240
|
+
const models = React.useMemo(() => ProcessUtil.modelBreaks(items), [items]);
|
|
241
|
+
// A turn's cards know what the user said after it: a choice they asked for is made.
|
|
242
|
+
const answers = React.useMemo(() => ProcessUtil.answers(items, message => userWords(MessageUtil.blocks(message)).copied), [items]);
|
|
243
|
+
const sent = React.useMemo(() => { var _a; return ({ of: new Map(((_a = state.outbox) !== null && _a !== void 0 ? _a : []).map(message => [message.message, message])), actions: outbox }); }, [state.outbox, outbox]);
|
|
244
|
+
const shown = useThreadRows(items, rows);
|
|
224
245
|
let lastTurn = items.length - 1;
|
|
225
246
|
while (lastTurn >= 0 && items[lastTurn].kind !== 'turn') {
|
|
226
247
|
lastTurn--;
|
|
@@ -234,15 +255,7 @@ export function MessageList({ state, outbox, rows }) {
|
|
|
234
255
|
const status = state.working || state.compacting ? React.createElement(RunStatus, { state: state }) : undefined;
|
|
235
256
|
const onHead = status && quiet(last);
|
|
236
257
|
return (React.createElement(Outbox.Provider, { value: sent },
|
|
237
|
-
items.map((item, index) => index < from ? null : (React.createElement("div", { key: item.key, "data-row": item.key, className:
|
|
238
|
-
'ta-thread-item',
|
|
239
|
-
index >= front && index < items.length - SETTLED_AFTER && 'ta-settled',
|
|
240
|
-
index === items.length - 1 && 'ta-thread-last',
|
|
241
|
-
index >= fresh && 'ta-thread-new',
|
|
242
|
-
item.kind === 'message' && item.message.role === 'user' && ASK_CLASS,
|
|
243
|
-
]
|
|
244
|
-
.filter(Boolean)
|
|
245
|
-
.join(' ') },
|
|
258
|
+
items.map((item, index) => index < shown.from ? null : (React.createElement("div", { key: item.key, "data-row": item.key, className: shown.className(index, item.kind === 'message' && item.message.role === 'user' && ASK_CLASS) },
|
|
246
259
|
breaks[index] !== undefined && React.createElement(TimeBreak, { timestamp: breaks[index] }),
|
|
247
260
|
models[index] && React.createElement(ModelBreak, { model: models[index] }),
|
|
248
261
|
React.createElement(CodeAnswer.Provider, { value: answers[index] },
|
|
@@ -10,7 +10,8 @@ import { type SideList } from './side-lists.js';
|
|
|
10
10
|
/**
|
|
11
11
|
* The pages on the rail: the pages a sidebar view lists are reached from it, and show beside it, as the double's from
|
|
12
12
|
* its list (the chats, else a sidebar view of before that lists it); those of extensions started on open from the
|
|
13
|
-
* launcher (ta-launcher.md), as they come and go; those only shown by something else (WebView.navigation)
|
|
13
|
+
* launcher (ta-launcher.md), as they come and go; those only shown by something else (WebView.navigation), and those
|
|
14
|
+
* of Me (WebView.group `me`, listed by useAccountEntries), nowhere.
|
|
14
15
|
*/
|
|
15
16
|
export declare function railPages(views: WebViewEntry[]): WebViewEntry[];
|
|
16
17
|
/**
|
|
@@ -7,11 +7,12 @@ import { DOUBLE_PAGE } from './side-lists.js';
|
|
|
7
7
|
/**
|
|
8
8
|
* The pages on the rail: the pages a sidebar view lists are reached from it, and show beside it, as the double's from
|
|
9
9
|
* its list (the chats, else a sidebar view of before that lists it); those of extensions started on open from the
|
|
10
|
-
* launcher (ta-launcher.md), as they come and go; those only shown by something else (WebView.navigation)
|
|
10
|
+
* launcher (ta-launcher.md), as they come and go; those only shown by something else (WebView.navigation), and those
|
|
11
|
+
* of Me (WebView.group `me`, listed by useAccountEntries), nowhere.
|
|
11
12
|
*/
|
|
12
13
|
export function railPages(views) {
|
|
13
14
|
const listed = new Set([DOUBLE_PAGE, ...views.flatMap(view => { var _a; return (view.location === 'sidebar' ? ((_a = view.pages) !== null && _a !== void 0 ? _a : []) : []); })]);
|
|
14
|
-
return views.filter(view => view.location === 'page' && !view.onOpen && view.navigation !== false && !listed.has(view.id));
|
|
15
|
+
return views.filter(view => view.location === 'page' && !view.onOpen && view.navigation !== false && view.group !== 'me' && !listed.has(view.id));
|
|
15
16
|
}
|
|
16
17
|
/** The hold of an entry of the navigation: the double's, the chats'; pages keep their menus (their fold and the settings). */
|
|
17
18
|
export function entryHold(id, double, holds) {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { TaServerInfo, TaServerUpdate } from '@celljs/ta-protocol';
|
|
1
|
+
import type { TaServerInfo, TaServerRelease, TaServerUpdate } from '@celljs/ta-protocol';
|
|
2
|
+
import { useT } from '../i18n/use-t.js';
|
|
3
|
+
import type { NoticeAction, TaNotices } from '../notices/notices-protocol.js';
|
|
2
4
|
export declare namespace ServeRestartUtil {
|
|
3
5
|
/** `v4.16.0`, with the commit of a build of the development channel: `v4.16.0 (695fbe1)`. */
|
|
4
6
|
function label(build: {
|
|
@@ -6,6 +8,8 @@ export declare namespace ServeRestartUtil {
|
|
|
6
8
|
build?: string;
|
|
7
9
|
}): string;
|
|
8
10
|
function key(update: TaServerUpdate): string;
|
|
11
|
+
/** The button that copies the command that installs a version, for the user to run it in a terminal. */
|
|
12
|
+
function copyCommand(command: string, notices: TaNotices, t: ReturnType<typeof useT>): NoticeAction;
|
|
9
13
|
/** Whether the page may restart Ta: the owner, of a Ta service that can restart itself. */
|
|
10
14
|
function restartable(server: TaServerInfo | undefined): boolean;
|
|
11
15
|
}
|
|
@@ -17,10 +21,15 @@ export interface RestartTa {
|
|
|
17
21
|
update?: TaServerUpdate;
|
|
18
22
|
/** Asks the user first, unless they already said so (the button of the notice of an update). */
|
|
19
23
|
restart(ask?: boolean): Promise<void>;
|
|
24
|
+
/** A newer version published, for the owner to install. */
|
|
25
|
+
release?: TaServerRelease;
|
|
26
|
+
/** Installs it, then restarts Ta to it where it can; a failure is told with the command to run by hand. */
|
|
27
|
+
install(): Promise<void>;
|
|
20
28
|
}
|
|
21
29
|
export declare function useRestartTa(): RestartTa;
|
|
22
30
|
/**
|
|
23
|
-
* Tells of
|
|
31
|
+
* Tells of a newer version published (TaServerInfo.release), with the command that installs it, once for each version;
|
|
32
|
+
* and of what restarting Ta is about, in a corner: another build installed (an update of Ta Desktop, `npm i -g`, a
|
|
24
33
|
* build of the repository), with Restart and Later, once for each build; Ta restarting, then back with its version.
|
|
25
34
|
*/
|
|
26
35
|
export declare function ServeRestartNotices(): null;
|
|
@@ -4,6 +4,8 @@ import { useT } from '../i18n/use-t.js';
|
|
|
4
4
|
import { storage } from '../workbench-util.js';
|
|
5
5
|
/** The build installed that the user put off restarting for (Later): not asked about again on this device. */
|
|
6
6
|
const LATER_KEY = 'ta.update.later';
|
|
7
|
+
/** The version published that the user put off installing (Later): not told of again on this device. */
|
|
8
|
+
const RELEASE_LATER_KEY = 'ta.release.later';
|
|
7
9
|
export var ServeRestartUtil;
|
|
8
10
|
(function (ServeRestartUtil) {
|
|
9
11
|
/** `v4.16.0`, with the commit of a build of the development channel: `v4.16.0 (695fbe1)`. */
|
|
@@ -16,6 +18,14 @@ export var ServeRestartUtil;
|
|
|
16
18
|
return `${update.version}+${(_a = update.build) !== null && _a !== void 0 ? _a : ''}`;
|
|
17
19
|
}
|
|
18
20
|
ServeRestartUtil.key = key;
|
|
21
|
+
/** The button that copies the command that installs a version, for the user to run it in a terminal. */
|
|
22
|
+
function copyCommand(command, notices, t) {
|
|
23
|
+
return {
|
|
24
|
+
label: t('ta.release.copy'),
|
|
25
|
+
run: () => { var _a; return void ((_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText(command).then(() => notices.notify(t('ta.copied'), { level: 'success', key: 'ta-serve-release-copied' })).catch(() => undefined)); },
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
ServeRestartUtil.copyCommand = copyCommand;
|
|
19
29
|
/** Whether the page may restart Ta: the owner, of a Ta service that can restart itself. */
|
|
20
30
|
function restartable(server) {
|
|
21
31
|
return !!server && !server.member && server.restartable === true;
|
|
@@ -32,18 +42,32 @@ export function useRestartTa() {
|
|
|
32
42
|
}
|
|
33
43
|
await workbench.restartServer().catch(error => notices.error(error));
|
|
34
44
|
}, [t, notices, workbench]);
|
|
45
|
+
const release = (server === null || server === void 0 ? void 0 : server.member) ? undefined : server === null || server === void 0 ? void 0 : server.release;
|
|
46
|
+
const install = React.useCallback(async () => {
|
|
47
|
+
if (!release || release.installing) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
await workbench.installRelease().catch(error => notices.notify(t('ta.release.failed', { version: `v${release.version}` }), {
|
|
51
|
+
level: 'error',
|
|
52
|
+
key: 'ta-serve-release-failed',
|
|
53
|
+
sticky: true,
|
|
54
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
55
|
+
action: ServeRestartUtil.copyCommand(release.command, notices, t),
|
|
56
|
+
}));
|
|
57
|
+
}, [release, workbench, notices, t]);
|
|
35
58
|
const can = ServeRestartUtil.restartable(server);
|
|
36
|
-
return { can, restarting: !!restarting, update: can ? server === null || server === void 0 ? void 0 : server.update : undefined, restart };
|
|
59
|
+
return { can, restarting: !!restarting, update: can ? server === null || server === void 0 ? void 0 : server.update : undefined, restart, release, install };
|
|
37
60
|
}
|
|
38
61
|
/**
|
|
39
|
-
* Tells of
|
|
62
|
+
* Tells of a newer version published (TaServerInfo.release), with the command that installs it, once for each version;
|
|
63
|
+
* and of what restarting Ta is about, in a corner: another build installed (an update of Ta Desktop, `npm i -g`, a
|
|
40
64
|
* build of the repository), with Restart and Later, once for each build; Ta restarting, then back with its version.
|
|
41
65
|
*/
|
|
42
66
|
export function ServeRestartNotices() {
|
|
43
67
|
const t = useT();
|
|
44
68
|
const [{ server }] = useWorkbench();
|
|
45
69
|
const [, notices] = useNotices();
|
|
46
|
-
const { update, restarting, restart } = useRestartTa();
|
|
70
|
+
const { update, restarting, restart, release, install, can } = useRestartTa();
|
|
47
71
|
const told = React.useRef(undefined);
|
|
48
72
|
const key = update && ServeRestartUtil.key(update);
|
|
49
73
|
React.useEffect(() => {
|
|
@@ -69,6 +93,43 @@ export function ServeRestartNotices() {
|
|
|
69
93
|
told.current = undefined;
|
|
70
94
|
}
|
|
71
95
|
}, [key, notices]);
|
|
96
|
+
const releaseTold = React.useRef(undefined);
|
|
97
|
+
React.useEffect(() => {
|
|
98
|
+
var _a, _b;
|
|
99
|
+
const releaseKey = release && `${release.version}${release.installing ? ':installing' : ''}`;
|
|
100
|
+
if (((_a = releaseTold.current) === null || _a === void 0 ? void 0 : _a.key) === releaseKey) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (releaseTold.current) {
|
|
104
|
+
notices.dismiss(releaseTold.current.id);
|
|
105
|
+
releaseTold.current = undefined;
|
|
106
|
+
}
|
|
107
|
+
// Installed, or none published after all: nothing to tell of any more.
|
|
108
|
+
if (!release || !releaseKey) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const version = `v${release.version}`;
|
|
112
|
+
if (release.installing) {
|
|
113
|
+
releaseTold.current = { key: releaseKey, id: notices.notify(t('ta.release.installing', { version }), { key: 'ta-serve-release', sticky: true }) };
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (((_b = storage()) === null || _b === void 0 ? void 0 : _b.getItem(RELEASE_LATER_KEY)) === release.version) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
releaseTold.current = {
|
|
120
|
+
key: releaseKey,
|
|
121
|
+
id: notices.notify(t('ta.release.available', { version }), {
|
|
122
|
+
detail: t('ta.release.detail', { command: release.command }),
|
|
123
|
+
key: 'ta-serve-release',
|
|
124
|
+
sticky: true,
|
|
125
|
+
actions: [
|
|
126
|
+
{ label: t('ta.update.later'), run: () => { var _a; return (_a = storage()) === null || _a === void 0 ? void 0 : _a.setItem(RELEASE_LATER_KEY, release.version); } },
|
|
127
|
+
ServeRestartUtil.copyCommand(release.command, notices, t),
|
|
128
|
+
],
|
|
129
|
+
action: { label: t(can ? 'ta.release.install' : 'ta.release.installOnly'), run: () => void install() },
|
|
130
|
+
}),
|
|
131
|
+
};
|
|
132
|
+
}, [release, can, install, notices, t]);
|
|
72
133
|
const restartingId = React.useRef(undefined);
|
|
73
134
|
// Read once the restart ended: a server read again meanwhile says nothing.
|
|
74
135
|
const serverNow = React.useRef(server);
|
|
@@ -128,7 +128,7 @@ function useMessagePeople() {
|
|
|
128
128
|
return React.useMemo(() => ({ me, ownerName }), [me, ownerName]);
|
|
129
129
|
}
|
|
130
130
|
export function SessionView({ store, server, workspace, info, onClosed, onActivity, leading, trailing, empty, notice, aboveComposer, belowComposer, draftText, compact = false, }) {
|
|
131
|
-
var _a;
|
|
131
|
+
var _a, _b, _c;
|
|
132
132
|
const t = useT();
|
|
133
133
|
const state = useSessionState(store);
|
|
134
134
|
const [, notices] = useNotices();
|
|
@@ -349,7 +349,8 @@ export function SessionView({ store, server, workspace, info, onClosed, onActivi
|
|
|
349
349
|
React.createElement("div", { className: "ta-thread" },
|
|
350
350
|
state.start > 0 && (React.createElement("div", { className: `ta-earlier ${state.loadingEarlier ? '' : 'ta-earlier-idle'}`, role: "status", "aria-label": state.loadingEarlier ? t('ta.session.earlier') : undefined, ...SCROLL_SKIP },
|
|
351
351
|
React.createElement("span", { className: "ta-spinner" }))),
|
|
352
|
-
state.messages.length === 0 &&
|
|
352
|
+
state.messages.length === 0 &&
|
|
353
|
+
((_b = (_a = addons.empty) !== null && _a !== void 0 ? _a : empty) !== null && _b !== void 0 ? _b : React.createElement("div", { className: "ta-empty" }, t('ta.session.empty', { cwd: (_c = info === null || info === void 0 ? void 0 : info.cwd) !== null && _c !== void 0 ? _c : '.' }))),
|
|
353
354
|
React.createElement(ConversationSession.Provider, { value: info },
|
|
354
355
|
React.createElement(MessageActions.Provider, { value: messageActions },
|
|
355
356
|
React.createElement(FileUrls.Provider, { value: fileUrl },
|
|
@@ -24,6 +24,7 @@ import { SignInSetupSettings, useSignInConfig } from './sign-in-setup.js';
|
|
|
24
24
|
* keys, and what is about Ta and this computer.
|
|
25
25
|
*/
|
|
26
26
|
export function useMoreSections(onClose, onDialog) {
|
|
27
|
+
var _a, _b;
|
|
27
28
|
const t = useT();
|
|
28
29
|
const language = useLanguage();
|
|
29
30
|
const [{ settings }, store] = useSettings();
|
|
@@ -194,15 +195,17 @@ export function useMoreSections(onClose, onDialog) {
|
|
|
194
195
|
icon: Info,
|
|
195
196
|
rows: workbench.server
|
|
196
197
|
? [
|
|
197
|
-
row('version', [t('ta.settings.version'), 'version'], React.createElement(Row, { label: t('ta.settings.version'), description: restartTa.update
|
|
198
|
+
row('version', [t('ta.settings.version'), 'version'], React.createElement(Row, { label: t('ta.settings.version'), description: restartTa.update
|
|
199
|
+
? t('ta.update.ready', { version: ServeRestartUtil.label(restartTa.update) })
|
|
200
|
+
: workbench.server.release && t('ta.release.available', { version: `v${workbench.server.release.version}` }) },
|
|
198
201
|
React.createElement("span", { className: "ta-path" }, ServeRestartUtil.label(workbench.server)))),
|
|
199
202
|
...(restartTa.can
|
|
200
203
|
? [
|
|
201
204
|
row('restart', [t('ta.restart'), t('ta.restart.description'), 'restart', 'update'], React.createElement(Row, { label: t('ta.restart'), description: t('ta.restart.description') },
|
|
202
|
-
React.createElement("button", { type: "button", className: `ta-button${restartTa.update ? ' ta-primary' : ''}`, disabled: restartTa.restarting, onClick: () => void restartTa.restart() },
|
|
203
|
-
restartTa.restarting ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(Icon, { icon: RotateCw, size: 15 }),
|
|
205
|
+
React.createElement("button", { type: "button", className: `ta-button${restartTa.update || restartTa.release ? ' ta-primary' : ''}`, disabled: restartTa.restarting || ((_a = restartTa.release) === null || _a === void 0 ? void 0 : _a.installing), onClick: () => void (restartTa.release && !restartTa.update ? restartTa.install() : restartTa.restart()) },
|
|
206
|
+
restartTa.restarting || ((_b = restartTa.release) === null || _b === void 0 ? void 0 : _b.installing) ? (React.createElement("span", { className: "ta-spinner" })) : (React.createElement(Icon, { icon: RotateCw, size: 15 })),
|
|
204
207
|
' ',
|
|
205
|
-
t('ta.restart.button')))),
|
|
208
|
+
t(restartTa.release && !restartTa.update ? 'ta.release.install' : 'ta.restart.button')))),
|
|
206
209
|
]
|
|
207
210
|
: []),
|
|
208
211
|
row('settings-files', [t('ta.settings.files'), 'settings.json', 'models.json', 'JSON'], React.createElement(SettingsFilesRow, null)),
|
|
@@ -40,6 +40,14 @@ export declare class ExtensionBoundary extends React.Component<BoundaryProps, {
|
|
|
40
40
|
componentDidUpdate(previous: BoundaryProps): void;
|
|
41
41
|
render(): string | number | bigint | boolean | React.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | Iterable<React.ReactNode> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.ReactPortal | null | undefined> | null | undefined;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* A component of a web extension that takes no props (a page, a view and its head, a tab of the workbench): drawn
|
|
45
|
+
* again as what it reads changes (its own state, the contexts and stores it uses) and as the language does, which it
|
|
46
|
+
* may read from `pi.ui`; not each time the page around it draws (a conversation shown, a minute gone).
|
|
47
|
+
*/
|
|
48
|
+
export declare function ExtensionPart({ component }: {
|
|
49
|
+
component: React.ComponentType;
|
|
50
|
+
}): React.JSX.Element;
|
|
43
51
|
/** A custom message of pi: with the renderer of its type, or as text when it is to be shown. */
|
|
44
52
|
export declare function CustomMessage({ message }: {
|
|
45
53
|
message: WebCustomMessage;
|
|
@@ -2,7 +2,7 @@ import { TA_RESUME_MESSAGE } from '@celljs/ta-protocol';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Callout } from '../components/callout.js';
|
|
4
4
|
import { Markdown } from '../components/markdown.js';
|
|
5
|
-
import { useT } from '../i18n/use-t.js';
|
|
5
|
+
import { useLanguage, useT } from '../i18n/use-t.js';
|
|
6
6
|
import { MessageUtil } from '../util/message.js';
|
|
7
7
|
/** The renderers of custom messages that web extensions registered. */
|
|
8
8
|
export const MessageRenderers = React.createContext({});
|
|
@@ -41,6 +41,17 @@ export class ExtensionBoundary extends React.Component {
|
|
|
41
41
|
return (_a = this.props.fallback) !== null && _a !== void 0 ? _a : React.createElement(ExtensionError, { name: this.props.name, error: this.state.error });
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* A component of a web extension that takes no props (a page, a view and its head, a tab of the workbench): drawn
|
|
46
|
+
* again as what it reads changes (its own state, the contexts and stores it uses) and as the language does, which it
|
|
47
|
+
* may read from `pi.ui`; not each time the page around it draws (a conversation shown, a minute gone).
|
|
48
|
+
*/
|
|
49
|
+
export function ExtensionPart({ component }) {
|
|
50
|
+
return React.createElement(StillPart, { component: component, language: useLanguage() });
|
|
51
|
+
}
|
|
52
|
+
const StillPart = React.memo(function StillPart({ component: Component }) {
|
|
53
|
+
return React.createElement(Component, null);
|
|
54
|
+
});
|
|
44
55
|
function ExtensionError({ name, error }) {
|
|
45
56
|
const t = useT();
|
|
46
57
|
return (React.createElement(Callout, { level: "error", detail: error.message }, t('ta.widget.failed', { name })));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { AlarmClock, Aperture, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, Bell, BellOff, BookOpen, Bot, Box, Bug, Building2, Calendar, CaseSensitive, ChartSpline, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsDownUp, ChevronsUpDown, ChevronUp, Circle, CircleAlert, CircleArrowRight, CircleHelp, Clipboard, ClipboardPaste, Clock, Cloud, Code, Coins, Columns2, Contact, Copy, CopyMinus, CornerDownRight, CornerUpLeft, Cpu, Crown, Database, Download, Ellipsis, ExternalLink, Eye, File, FileArchive, FileDiff, FilePlus, Files, FileText, Film, FlaskConical, Folder, FolderInput, FolderOpen, FolderPlus, FolderSearch, FolderTree, Forward, Gamepad2, Gauge, GitBranch, GitCommitHorizontal, Globe, Grip, HardDrive, Hash, Heart, House, Image, ImagePlus, Info, Keyboard, KeyRound, Laptop, LayoutDashboard, Lightbulb, Link, List, ListChecks, ListTodo, ListTree, ListX, LoaderCircle, LocateFixed, Lock, MapIcon, Maximize, Maximize2, Megaphone, MemoryStick, MessageCircle, MessageSquareDot, MessageSquareText, MessagesSquare, Mic, Minimize2, Minus, Monitor, MonitorSmartphone, MousePointer2, MousePointerClick, Package, PackageOpen, Paperclip, Pencil, Phone, Pin, PinOff, Play, Plus, Pointer, Power, Puzzle, QrCode, Radar, RefreshCw, Regex, Replace, ReplaceAll, Rocket, RotateCcw, Rows2, Save, Scan, ScanLine, ScrollText, Search, Send, Server, Share2, Shield, ShieldCheck, SlidersHorizontal, Smartphone, Sparkles, Square, SquareMinus, SquarePlus, SquareTerminal, Star, StarOff, Store, Target, Text, Timer, Trash2, TrendingDown, TrendingUp, Trophy, Undo2, Unplug, Upload, User, UserPlus, Users, Volume2, WholeWord, Wrench, X, Zap, } from 'lucide-react';
|
|
1
|
+
import { AlarmClock, Aperture, Archive, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, Bell, BellOff, BookOpen, Bot, Box, Bug, Building2, Calendar, Camera, CaseSensitive, ChartColumn, ChartSpline, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsDownUp, ChevronsUpDown, ChevronUp, Circle, CircleAlert, CircleArrowRight, CircleHelp, Clipboard, ClipboardPaste, Clock, Cloud, Code, Coins, Columns2, Contact, Copy, CopyMinus, CornerDownRight, CornerUpLeft, Cpu, Crown, Database, Download, Ellipsis, ExternalLink, Eye, File, FileArchive, FileDiff, FilePlus, Files, FileText, Film, FlaskConical, Folder, FolderInput, FolderOpen, FolderPlus, FolderSearch, FolderTree, Forward, Gamepad2, Gauge, GitBranch, GitCommitHorizontal, Globe, Grip, HardDrive, Hash, Headphones, Heart, House, Image, ImagePlus, Info, Keyboard, KeyRound, Laptop, LayoutDashboard, Lightbulb, Link, List, ListChecks, ListTodo, ListTree, ListX, LoaderCircle, LocateFixed, Lock, MapIcon, Maximize, Maximize2, Megaphone, MemoryStick, MessageCircle, MessageSquareDot, MessageSquareText, MessagesSquare, Mic, Minimize2, Minus, Monitor, MonitorSmartphone, MousePointer2, MousePointerClick, Package, PackageOpen, Paperclip, Pencil, Phone, Pin, PinOff, Play, Plus, Pointer, Power, Puzzle, QrCode, Quote, Radar, RefreshCw, Regex, Replace, ReplaceAll, Rocket, RotateCcw, Rows2, Save, Scan, ScanLine, ScrollText, Search, Send, Server, Share2, Shield, ShieldAlert, ShieldCheck, Shuffle, SlidersHorizontal, Smartphone, Sparkles, Square, SquareMinus, SquarePlus, SquareTerminal, Star, StarOff, Store, Target, Text, ThumbsDown, ThumbsUp, Timer, Trash2, TrendingDown, TrendingUp, Trophy, Undo2, Unplug, Upload, User, UserPlus, Users, Volume2, WholeWord, Wrench, X, Zap, } from 'lucide-react';
|
|
2
2
|
/** The icons a web extension gets as `pi.ui.icons`; names are lucide's. Only add: removing one breaks extensions. */
|
|
3
3
|
export const WEB_ICONS = Object.freeze({
|
|
4
4
|
AlarmClock,
|
|
5
5
|
Aperture,
|
|
6
|
+
Archive,
|
|
6
7
|
ArrowDown,
|
|
7
8
|
ArrowLeft,
|
|
8
9
|
ArrowRight,
|
|
@@ -16,7 +17,9 @@ export const WEB_ICONS = Object.freeze({
|
|
|
16
17
|
Bug,
|
|
17
18
|
Building2,
|
|
18
19
|
Calendar,
|
|
20
|
+
Camera,
|
|
19
21
|
CaseSensitive,
|
|
22
|
+
ChartColumn,
|
|
20
23
|
ChartSpline,
|
|
21
24
|
Check,
|
|
22
25
|
ChevronDown,
|
|
@@ -71,6 +74,7 @@ export const WEB_ICONS = Object.freeze({
|
|
|
71
74
|
Grip,
|
|
72
75
|
HardDrive,
|
|
73
76
|
Hash,
|
|
77
|
+
Headphones,
|
|
74
78
|
Heart,
|
|
75
79
|
House,
|
|
76
80
|
Image,
|
|
@@ -118,6 +122,7 @@ export const WEB_ICONS = Object.freeze({
|
|
|
118
122
|
Pointer,
|
|
119
123
|
Power,
|
|
120
124
|
Puzzle,
|
|
125
|
+
Quote,
|
|
121
126
|
QrCode,
|
|
122
127
|
Radar,
|
|
123
128
|
RefreshCw,
|
|
@@ -136,7 +141,9 @@ export const WEB_ICONS = Object.freeze({
|
|
|
136
141
|
Server,
|
|
137
142
|
Share2,
|
|
138
143
|
Shield,
|
|
144
|
+
ShieldAlert,
|
|
139
145
|
ShieldCheck,
|
|
146
|
+
Shuffle,
|
|
140
147
|
SlidersHorizontal,
|
|
141
148
|
Smartphone,
|
|
142
149
|
Sparkles,
|
|
@@ -149,6 +156,8 @@ export const WEB_ICONS = Object.freeze({
|
|
|
149
156
|
Store,
|
|
150
157
|
Target,
|
|
151
158
|
Text,
|
|
159
|
+
ThumbsDown,
|
|
160
|
+
ThumbsUp,
|
|
152
161
|
Timer,
|
|
153
162
|
Trash2,
|
|
154
163
|
TrendingDown,
|
|
@@ -64,6 +64,12 @@ export interface WebComposerAddon {
|
|
|
64
64
|
above?: React.ComponentType<{
|
|
65
65
|
conversation: WebConversation;
|
|
66
66
|
}>;
|
|
67
|
+
/**
|
|
68
|
+
* What a conversation of the extension's own shows before anything is said in it, in place of Ta's (an assistant's
|
|
69
|
+
* face, what it does, what to start with); undefined for the others. Asked as the conversation is drawn: answer at
|
|
70
|
+
* once. Newer than some Ta apps, which show their own.
|
|
71
|
+
*/
|
|
72
|
+
empty?(conversation: WebConversation): React.ReactNode | undefined;
|
|
67
73
|
}
|
|
68
74
|
/**
|
|
69
75
|
* An app of the rooms of Ta (WebExtensionAPI.registerRoomAddon), which the Rooms page draws as its own: a tile among the
|
|
@@ -127,7 +133,12 @@ export type WebViewLocation = 'page' | 'sidebar' | 'panel' | 'launcher' | 'board
|
|
|
127
133
|
* what they post), `work` (what Ta does for the user: scheduled tasks, its proposals, bots), `share` (what the user
|
|
128
134
|
* shares, who is let in), `more` (the rest).
|
|
129
135
|
*/
|
|
130
|
-
|
|
136
|
+
/**
|
|
137
|
+
* Where a page is listed: a group of Discover (`people`, `work`, `share`, `more`), or `me`, among the entries of Me (the
|
|
138
|
+
* last tab of a phone; the menu of the account elsewhere), for what is the user's own (their feedback), never in the
|
|
139
|
+
* navigation nor under Discover. Older Ta apps list a page of `me` under Discover's `more`.
|
|
140
|
+
*/
|
|
141
|
+
export type WebPageGroup = 'people' | 'work' | 'share' | 'more' | 'me';
|
|
131
142
|
export interface WebView {
|
|
132
143
|
title: WebLabel;
|
|
133
144
|
render: React.ComponentType;
|
|
@@ -159,7 +170,7 @@ export interface WebView {
|
|
|
159
170
|
* which the navigation then leaves out, since the view lists them.
|
|
160
171
|
*/
|
|
161
172
|
pages?: string[];
|
|
162
|
-
/** A page under Discover: the group it is listed in there
|
|
173
|
+
/** A page under Discover: the group it is listed in there, default `more`; `me`, an entry of Me instead. Newer than some Ta apps. */
|
|
163
174
|
group?: WebPageGroup;
|
|
164
175
|
/**
|
|
165
176
|
* `false`: a page only shown by something else (a room of its kind, a link, a row of its settings), never in the
|
|
@@ -334,6 +345,8 @@ export interface WebMenuItem {
|
|
|
334
345
|
disabled?: boolean;
|
|
335
346
|
/** Cannot be undone, as delete: drawn in red. */
|
|
336
347
|
danger?: boolean;
|
|
348
|
+
/** One of a choice (a status, a sort): the one chosen is checked on the right. Newer than some Ta apps. */
|
|
349
|
+
checked?: boolean;
|
|
337
350
|
run(): void;
|
|
338
351
|
}
|
|
339
352
|
/** A view of any web extension, as `ui.useView` sees it. */
|
|
@@ -109,6 +109,12 @@ export interface WebPartnersUI {
|
|
|
109
109
|
* partners picked already (the friend of a chat of two). Newer than some Ta apps: `pi.ui.startGroup?.(…)`.
|
|
110
110
|
*/
|
|
111
111
|
startGroup(partner?: string): void;
|
|
112
|
+
/**
|
|
113
|
+
* Opens a partner of any extension by its id (a group chat's: its room id), as its row does: false when there is none
|
|
114
|
+
* (its extension not loaded). For an extension that works in a group chat it did not make (a class's). Newer than some
|
|
115
|
+
* Ta apps: `pi.ui.openPartner?.(…)`.
|
|
116
|
+
*/
|
|
117
|
+
openPartner(id: string, kind?: WebPartnerKind): Promise<boolean>;
|
|
112
118
|
}
|
|
113
119
|
/** A partner as the page lists it. */
|
|
114
120
|
export interface WebPartnerEntry extends WebPartner {
|
|
@@ -21,6 +21,14 @@ export var WebHomeUtil;
|
|
|
21
21
|
useHomeShown: () => React.useSyncExternalStore(subscribe, read, read),
|
|
22
22
|
useTasks: () => React.useSyncExternalStore(extensions.tasks.subscribe, extensions.tasks.tasks, extensions.tasks.tasks),
|
|
23
23
|
startGroup: partner => openGroupPicker(extensions, partner === undefined ? undefined : extensions.partners.partners().find(each => each.key === `${extension}/${partner}`)),
|
|
24
|
+
openPartner: async (id, kind) => {
|
|
25
|
+
const partner = extensions.partners.partners().find(each => each.id === id && (!kind || each.kind === kind));
|
|
26
|
+
if (!partner || stopped()) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
await partner.open();
|
|
30
|
+
return true;
|
|
31
|
+
},
|
|
24
32
|
};
|
|
25
33
|
}
|
|
26
34
|
WebHomeUtil.ui = ui;
|