@celljs/ta-web 4.21.0 → 4.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/browser/assistant/assistant-chat-list.js +5 -1
- package/esm/browser/assistant/assistant-conversation.js +1 -1
- package/esm/browser/assistant/assistant-initiative.d.ts +5 -1
- package/esm/browser/assistant/assistant-initiative.js +11 -3
- package/esm/browser/assistant/call-keeper.d.ts +2 -1
- package/esm/browser/assistant/call-keeper.js +4 -2
- package/esm/browser/assistant/call-screen.d.ts +1 -1
- package/esm/browser/assistant/call-turn-end.d.ts +11 -2
- package/esm/browser/assistant/call-turn-end.js +21 -5
- package/esm/browser/assistant/read-aloud.d.ts +1 -1
- package/esm/browser/assistant/realtime-voice.d.ts +1 -1
- package/esm/browser/assistant/voice-call-bar.d.ts +5 -2
- package/esm/browser/assistant/voice-call-bar.js +12 -0
- package/esm/browser/assistant/voice-call-protocol.d.ts +78 -0
- package/esm/browser/assistant/voice-call-protocol.js +2 -0
- package/esm/browser/assistant/voice-call.d.ts +17 -65
- package/esm/browser/assistant/voice-call.js +45 -1
- package/esm/browser/assistant/voice-reopen.d.ts +1 -1
- package/esm/browser/components/account-menu.js +28 -7
- package/esm/browser/components/chat-home-util.d.ts +13 -2
- package/esm/browser/components/chat-home-util.js +29 -0
- package/esm/browser/components/chat-home.d.ts +18 -4
- package/esm/browser/components/chat-home.js +11 -3
- package/esm/browser/components/chat-list.js +4 -2
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/earlier-messages.d.ts +4 -0
- package/esm/browser/components/earlier-messages.js +10 -2
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/message-footer.d.ts +0 -2
- package/esm/browser/components/message-footer.js +1 -8
- package/esm/browser/components/message-images.d.ts +22 -0
- package/esm/browser/components/message-images.js +90 -1
- package/esm/browser/components/message-steps.js +9 -0
- package/esm/browser/components/message-user.js +8 -1
- package/esm/browser/components/partner-row-util.d.ts +28 -0
- package/esm/browser/components/partner-row-util.js +45 -0
- package/esm/browser/components/partner-row.d.ts +18 -0
- package/esm/browser/components/partner-row.js +60 -0
- package/esm/browser/components/profile-view.d.ts +2 -2
- package/esm/browser/components/profile-view.js +6 -3
- package/esm/browser/components/web-composer.d.ts +5 -2
- package/esm/browser/components/web-composer.js +10 -5
- package/esm/browser/extension/extension-view.js +2 -2
- package/esm/browser/extension/icons.js +4 -1
- package/esm/browser/extension/web-api-call.d.ts +45 -0
- package/esm/browser/extension/web-api-call.js +2 -0
- package/esm/browser/extension/web-api-components.d.ts +37 -2
- package/esm/browser/extension/web-api-contributions.d.ts +2 -31
- package/esm/browser/extension/web-api-home.d.ts +1 -0
- package/esm/browser/extension/web-api-partners.d.ts +112 -0
- package/esm/browser/extension/web-api-partners.js +2 -0
- package/esm/browser/extension/web-extension-api.d.ts +12 -15
- package/esm/browser/extension/web-extension-context.d.ts +2 -3
- package/esm/browser/extension/web-extension-context.js +7 -7
- package/esm/browser/extension/web-extension-protocol.d.ts +8 -2
- package/esm/browser/extension/web-extension-run.d.ts +2 -1
- package/esm/browser/extension/web-extension-run.js +1 -0
- package/esm/browser/extension/web-extensions-running.d.ts +2 -0
- package/esm/browser/extension/web-extensions-running.js +3 -0
- package/esm/browser/extension/web-extensions.d.ts +1 -1
- package/esm/browser/extension/web-home.d.ts +11 -19
- package/esm/browser/extension/web-home.js +15 -68
- package/esm/browser/extension/web-partners.d.ts +8 -0
- package/esm/browser/extension/web-partners.js +13 -0
- package/esm/browser/extension/web-row-board.d.ts +38 -0
- package/esm/browser/extension/web-row-board.js +79 -0
- package/esm/browser/i18n/locales.d.ts +28 -1
- package/esm/browser/i18n/messages-ja.js +27 -0
- package/esm/browser/i18n/messages-zh-tw.js +27 -0
- package/esm/browser/i18n/messages.d.ts +27 -0
- package/esm/browser/i18n/messages.js +54 -0
- package/esm/browser/index.d.ts +4 -0
- package/esm/browser/index.js +4 -0
- package/esm/browser/partners/group-picker.d.ts +18 -0
- package/esm/browser/partners/group-picker.js +81 -0
- package/esm/browser/partners/partners-extension.d.ts +14 -0
- package/esm/browser/partners/partners-extension.js +78 -0
- package/esm/browser/partners/partners-util.d.ts +32 -0
- package/esm/browser/partners/partners-util.js +68 -0
- package/esm/browser/partners/partners-view.d.ts +32 -0
- package/esm/browser/partners/partners-view.js +103 -0
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +21 -0
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation-column.js +21 -0
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +2 -2
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +1 -1
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +1 -1
- package/esm/browser/util/image-shrink.d.ts +26 -0
- package/esm/browser/util/image-shrink.js +60 -0
- package/esm/browser/util/process.d.ts +7 -3
- package/esm/browser/util/process.js +18 -18
- package/lib/browser/assistant/assistant-chat-list.js +5 -1
- package/lib/browser/assistant/assistant-conversation.js +1 -1
- package/lib/browser/assistant/assistant-initiative.d.ts +5 -1
- package/lib/browser/assistant/assistant-initiative.js +11 -3
- package/lib/browser/assistant/call-keeper.d.ts +2 -1
- package/lib/browser/assistant/call-keeper.js +4 -2
- package/lib/browser/assistant/call-screen.d.ts +1 -1
- package/lib/browser/assistant/call-turn-end.d.ts +11 -2
- package/lib/browser/assistant/call-turn-end.js +22 -6
- package/lib/browser/assistant/read-aloud.d.ts +1 -1
- package/lib/browser/assistant/realtime-voice.d.ts +1 -1
- package/lib/browser/assistant/voice-call-bar.d.ts +5 -2
- package/lib/browser/assistant/voice-call-bar.js +12 -0
- package/lib/browser/assistant/voice-call-protocol.d.ts +79 -0
- package/lib/browser/assistant/voice-call-protocol.js +3 -0
- package/lib/browser/assistant/voice-call.d.ts +17 -65
- package/lib/browser/assistant/voice-call.js +45 -1
- package/lib/browser/assistant/voice-reopen.d.ts +1 -1
- package/lib/browser/components/account-menu.js +27 -6
- package/lib/browser/components/chat-home-util.d.ts +13 -2
- package/lib/browser/components/chat-home-util.js +29 -0
- package/lib/browser/components/chat-home.d.ts +18 -4
- package/lib/browser/components/chat-home.js +12 -3
- package/lib/browser/components/chat-list.js +4 -2
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/earlier-messages.d.ts +4 -0
- package/lib/browser/components/earlier-messages.js +10 -2
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/message-footer.d.ts +0 -2
- package/lib/browser/components/message-footer.js +0 -8
- package/lib/browser/components/message-images.d.ts +22 -0
- package/lib/browser/components/message-images.js +92 -2
- package/lib/browser/components/message-steps.js +9 -0
- package/lib/browser/components/message-user.js +7 -0
- package/lib/browser/components/partner-row-util.d.ts +29 -0
- package/lib/browser/components/partner-row-util.js +48 -0
- package/lib/browser/components/partner-row.d.ts +19 -0
- package/lib/browser/components/partner-row.js +96 -0
- package/lib/browser/components/profile-view.d.ts +2 -2
- package/lib/browser/components/profile-view.js +6 -3
- package/lib/browser/components/web-composer.d.ts +5 -2
- package/lib/browser/components/web-composer.js +10 -5
- package/lib/browser/extension/extension-view.js +2 -2
- package/lib/browser/extension/icons.js +3 -0
- package/lib/browser/extension/web-api-call.d.ts +46 -0
- package/lib/browser/extension/web-api-call.js +3 -0
- package/lib/browser/extension/web-api-components.d.ts +37 -2
- package/lib/browser/extension/web-api-contributions.d.ts +2 -31
- package/lib/browser/extension/web-api-home.d.ts +1 -0
- package/lib/browser/extension/web-api-partners.d.ts +113 -0
- package/lib/browser/extension/web-api-partners.js +3 -0
- package/lib/browser/extension/web-extension-api.d.ts +12 -15
- package/lib/browser/extension/web-extension-context.d.ts +2 -3
- package/lib/browser/extension/web-extension-context.js +7 -7
- package/lib/browser/extension/web-extension-protocol.d.ts +8 -2
- package/lib/browser/extension/web-extension-run.d.ts +2 -1
- package/lib/browser/extension/web-extension-run.js +1 -0
- package/lib/browser/extension/web-extensions-running.d.ts +2 -0
- package/lib/browser/extension/web-extensions-running.js +3 -0
- package/lib/browser/extension/web-extensions.d.ts +1 -1
- package/lib/browser/extension/web-home.d.ts +11 -19
- package/lib/browser/extension/web-home.js +15 -68
- package/lib/browser/extension/web-partners.d.ts +9 -0
- package/lib/browser/extension/web-partners.js +17 -0
- package/lib/browser/extension/web-row-board.d.ts +39 -0
- package/lib/browser/extension/web-row-board.js +83 -0
- package/lib/browser/i18n/locales.d.ts +28 -1
- package/lib/browser/i18n/messages-ja.js +27 -0
- package/lib/browser/i18n/messages-zh-tw.js +27 -0
- package/lib/browser/i18n/messages.d.ts +27 -0
- package/lib/browser/i18n/messages.js +54 -0
- package/lib/browser/index.d.ts +4 -0
- package/lib/browser/index.js +4 -0
- package/lib/browser/partners/group-picker.d.ts +19 -0
- package/lib/browser/partners/group-picker.js +119 -0
- package/lib/browser/partners/partners-extension.d.ts +15 -0
- package/lib/browser/partners/partners-extension.js +114 -0
- package/lib/browser/partners/partners-util.d.ts +33 -0
- package/lib/browser/partners/partners-util.js +71 -0
- package/lib/browser/partners/partners-view.d.ts +33 -0
- package/lib/browser/partners/partners-view.js +144 -0
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +21 -0
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation-column.js +21 -0
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +2 -2
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +1 -1
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +1 -1
- package/lib/browser/util/image-shrink.d.ts +27 -0
- package/lib/browser/util/image-shrink.js +63 -0
- package/lib/browser/util/process.d.ts +7 -3
- package/lib/browser/util/process.js +18 -18
- package/package.json +7 -7
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useT } from '../i18n/use-t.js';
|
|
3
|
+
import { PartnersUtil } from '../partners/partners-util.js';
|
|
4
|
+
import { RowText } from './chat-home.js';
|
|
5
|
+
import { ChatHomeUtil } from './chat-home-util.js';
|
|
6
|
+
import { ChatDot } from './chat-list-row.js';
|
|
7
|
+
import { ContextMenuUtil, useContextMenu } from './context-menu.js';
|
|
8
|
+
import { HostTag } from './host-tag.js';
|
|
9
|
+
import { PartnerRowUtil } from './partner-row-util.js';
|
|
10
|
+
import { SwipeRow } from './swipe-row.js';
|
|
11
|
+
/**
|
|
12
|
+
* A partner (docs/design/ta-partners.md), the same row wherever it is: on the page of the partners as a contact, in the
|
|
13
|
+
* double's list as a conversation (`onPin` given). Its face (or its icon on a tile of its tint), its name, what was said
|
|
14
|
+
* last (else what it is), when; an amber dot for what the user has not seen or one asking, a blue ? while it waits for
|
|
15
|
+
* them, a spinner while it answers. Its menu (a right click, a long press) and what a swipe shows behind it are the
|
|
16
|
+
* same for every kind (PartnerRowUtil).
|
|
17
|
+
*/
|
|
18
|
+
export function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
const t = useT();
|
|
21
|
+
const [menu, openMenu] = useContextMenu();
|
|
22
|
+
const [opening, setOpening] = React.useState(false);
|
|
23
|
+
const Glyph = partner.icon;
|
|
24
|
+
const Own = partner.face;
|
|
25
|
+
const unseen = PartnersUtil.unseen(partner);
|
|
26
|
+
const asks = !partner.status && !!((_a = partner.chat) === null || _a === void 0 ? void 0 : _a.asks);
|
|
27
|
+
const go = () => {
|
|
28
|
+
setOpening(true);
|
|
29
|
+
void open(partner)
|
|
30
|
+
.catch(error => console.error(`A partner of ${partner.extension} failed to open:`, error))
|
|
31
|
+
.finally(() => setOpening(false));
|
|
32
|
+
};
|
|
33
|
+
const pin = onPin && { label: t(pinned ? 'ta.chat.unpin' : 'ta.chat.pin'), run: () => onPin(!pinned) };
|
|
34
|
+
// Opened as the row opens what it is (TaWebExtensions.openHome): a page it shows is the row's, as its conversation is.
|
|
35
|
+
const info = partner.info && {
|
|
36
|
+
label: t(PartnerRowUtil.infoLabel(partner.kind)),
|
|
37
|
+
short: t(PartnerRowUtil.infoShort(partner.kind)),
|
|
38
|
+
run: () => void open({ ...partner, open: () => { var _a; return (_a = partner.info) === null || _a === void 0 ? void 0 : _a.call(partner); } }).catch(error => console.error(`The info of a partner of ${partner.extension} failed to open:`, error)),
|
|
39
|
+
};
|
|
40
|
+
const away = PartnerRowUtil.away(partner, !!onPin);
|
|
41
|
+
const swipe = PartnerRowUtil.swipe(pin, info, away);
|
|
42
|
+
return (React.createElement(SwipeRow, { as: "li", className: `ta-chat-row ta-partner-row${selected ? ' ta-selected' : ''}`, "data-unseen": unseen && !asks ? '' : undefined, "data-asks": asks ? '' : undefined, actions: swipe.length ? swipe : undefined, overlay: menu, onContextMenu: event => {
|
|
43
|
+
const own = partner.menu ? ChatHomeUtil.menu(partner.menu()) : [];
|
|
44
|
+
const first = [{ label: t('ta.chat.open'), run: go }, ...(pin ? [pin] : []), ...(info ? [{ label: info.label, run: info.run }] : [])];
|
|
45
|
+
const last = away ? [{ label: away.label, run: away.run, danger: true }] : [];
|
|
46
|
+
openMenu(event, [
|
|
47
|
+
...ContextMenuUtil.sections(first),
|
|
48
|
+
...(own.length ? ['-', ...own] : []),
|
|
49
|
+
...(last.length ? ['-', ...last] : []),
|
|
50
|
+
]);
|
|
51
|
+
} },
|
|
52
|
+
React.createElement("button", { type: "button", className: "ta-chat-item", title: partner.name, "aria-current": selected ? 'true' : undefined, onClick: go },
|
|
53
|
+
React.createElement("span", { className: "ta-chat-avatar-box" },
|
|
54
|
+
Own && !opening ? (React.createElement("span", { className: "ta-chat-face", style: { width: 38, height: 38 }, "aria-hidden": "true" },
|
|
55
|
+
React.createElement(Own, { size: 38 }))) : (React.createElement("span", { className: "ta-chat-avatar ta-chat-icon", style: { background: `var(--ta-tint-${partner.tone})`, color: `var(--ta-tint-ink-${partner.tone})`, width: 38, height: 38 }, "aria-hidden": "true" }, opening ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(Glyph, { size: 18, strokeWidth: 1.8 }))),
|
|
56
|
+
partner.online && React.createElement("span", { className: "ta-partner-online", "aria-hidden": "true" }),
|
|
57
|
+
React.createElement(ChatDot, { unseen: unseen, asks: asks })),
|
|
58
|
+
React.createElement(RowText, { title: partner.name, time: time, line: PartnersUtil.line(partner, t('ta.partners.waiting')), unseen: unseen, busy: !partner.status && !!((_b = partner.chat) === null || _b === void 0 ? void 0 : _b.busy), tag: partner.location ? React.createElement(HostTag, { location: partner.location }) : undefined, badge: partner.friends ? t('ta.partners.withFriends') : undefined }))));
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=partner-row.js.map
|
|
@@ -2,8 +2,8 @@ import type { TaIdentity } from '@celljs/ta-protocol';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
/** The identity of the computer in use, its name and picture: read once connected, and again when it changes. */
|
|
4
4
|
export declare function useIdentity(): TaIdentity | undefined;
|
|
5
|
-
/** The account in use as a line: "Company account · su"
|
|
6
|
-
export declare function useAccountLine(): string | undefined;
|
|
5
|
+
/** The account in use as a line: "Company account · su"; null while signed out, undefined until read. */
|
|
6
|
+
export declare function useAccountLine(): string | null | undefined;
|
|
7
7
|
/** The profile, over the page: the picture, the name, and the account, which opens My devices. */
|
|
8
8
|
export declare function ProfileDialog({ onClose, onDevices }: {
|
|
9
9
|
onClose(): void;
|
|
@@ -38,12 +38,15 @@ export function useIdentity() {
|
|
|
38
38
|
}, [online, workbench]);
|
|
39
39
|
return identity;
|
|
40
40
|
}
|
|
41
|
-
/** The account in use as a line: "Company account · su"
|
|
41
|
+
/** The account in use as a line: "Company account · su"; null while signed out, undefined until read. */
|
|
42
42
|
export function useAccountLine() {
|
|
43
43
|
const side = useAccountSide();
|
|
44
|
-
const { info } = useAccountInfo(side, 15000);
|
|
44
|
+
const { info, failed } = useAccountInfo(side, 15000);
|
|
45
45
|
const way = useAccountWay();
|
|
46
|
-
|
|
46
|
+
if ((info === null || info === void 0 ? void 0 : info.account) && !info.waiting) {
|
|
47
|
+
return `${way(info.account.id)} · ${accountName(info.account)}`;
|
|
48
|
+
}
|
|
49
|
+
return info || failed ? null : undefined;
|
|
47
50
|
}
|
|
48
51
|
/** The profile, over the page: the picture, the name, and the account, which opens My devices. */
|
|
49
52
|
export function ProfileDialog({ onClose, onDevices }) {
|
|
@@ -15,5 +15,8 @@ export interface WebComposerHostProps extends WebComposerProps {
|
|
|
15
15
|
/** The hosts of ssh, which the button offers too. */
|
|
16
16
|
remote?: FolderPickerRemote;
|
|
17
17
|
}
|
|
18
|
-
/**
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The message box as web extensions get it (`pi.ui.Composer`): text, and pictures when it takes them (shrunk within
|
|
20
|
+
* the limits given), `@` for the names they give; a failure is a notice of the page.
|
|
21
|
+
*/
|
|
22
|
+
export declare function WebComposer({ notices, placeholder, onSend, images, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }: WebComposerHostProps): React.JSX.Element;
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useLanguage, useT } from '../i18n/use-t.js';
|
|
3
3
|
import { ComposerUtil } from '../util/composer.js';
|
|
4
|
+
import { ImageShrink } from '../util/image-shrink.js';
|
|
4
5
|
import { ComposerAddonUtil } from './composer-addon-util.js';
|
|
5
6
|
import { ComposerBox } from './composer-box.js';
|
|
6
7
|
import { useDirectoryCommands } from './directory-commands.js';
|
|
7
8
|
import { DirectoryButton } from './folder-picker.js';
|
|
8
|
-
/**
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The message box as web extensions get it (`pi.ui.Composer`): text, and pictures when it takes them (shrunk within
|
|
11
|
+
* the limits given), `@` for the names they give; a failure is a notice of the page.
|
|
12
|
+
*/
|
|
13
|
+
export function WebComposer({ notices, placeholder, onSend, images, mentions, mentionLabel, actions, cwd, onPickCwd, commands, working, onStop, voiceSends, onTalkSent, onListening, after, draft, server, listDirectory, serverCwd, remote, }) {
|
|
10
14
|
const t = useT();
|
|
11
15
|
const language = useLanguage();
|
|
12
16
|
const [query, setQuery] = React.useState();
|
|
13
17
|
const found = useDirectoryCommands(server, commands ? cwd || serverCwd : undefined);
|
|
14
18
|
const listed = React.useMemo(() => found.map(command => ({ name: command.name, description: ComposerUtil.commandDescription(command, language, t) })), [found, language, t]);
|
|
15
|
-
return (React.createElement(ComposerBox, { placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t('ta.composer.label'), onSend: async (text) => {
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
return (React.createElement(ComposerBox, { placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t('ta.composer.label'), onSend: async (text, attached) => {
|
|
20
|
+
const limits = typeof images === 'object' ? images : undefined;
|
|
21
|
+
await onSend(text, limits ? await Promise.all(attached.map(image => ImageShrink.shrink(image, limits))) : attached);
|
|
22
|
+
}, images: !!images, commands: listed, onMentionQuery: mentions ? setQuery : undefined, mentions: mentions && query !== undefined
|
|
18
23
|
? {
|
|
19
24
|
items: ComposerUtil.commands(mentions, query).map(mention => ({
|
|
20
25
|
key: mention.name,
|
|
@@ -2,7 +2,6 @@ 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 { ResumeBreak } from '../components/message-footer.js';
|
|
6
5
|
import { useT } from '../i18n/use-t.js';
|
|
7
6
|
import { MessageUtil } from '../util/message.js';
|
|
8
7
|
/** The renderers of custom messages that web extensions registered. */
|
|
@@ -49,8 +48,9 @@ function ExtensionError({ name, error }) {
|
|
|
49
48
|
/** A custom message of pi: with the renderer of its type, or as text when it is to be shown. */
|
|
50
49
|
export function CustomMessage({ message }) {
|
|
51
50
|
const Renderer = React.useContext(MessageRenderers)[message.customType];
|
|
51
|
+
// A step of the turn it went on with (ProcessUtil.items), not a message of its own.
|
|
52
52
|
if (message.customType === TA_RESUME_MESSAGE) {
|
|
53
|
-
return
|
|
53
|
+
return null;
|
|
54
54
|
}
|
|
55
55
|
if (Renderer) {
|
|
56
56
|
return (React.createElement(ExtensionBoundary, { name: message.customType, resetKey: Renderer },
|
|
@@ -1,4 +1,4 @@
|
|
|
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, Megaphone, MemoryStick, MessageCircle, MessageSquareDot, MessageSquareText, MessagesSquare, Mic, 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, 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, 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';
|
|
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,
|
|
@@ -92,6 +92,7 @@ export const WEB_ICONS = Object.freeze({
|
|
|
92
92
|
Lock,
|
|
93
93
|
Map: MapIcon,
|
|
94
94
|
Maximize,
|
|
95
|
+
Maximize2,
|
|
95
96
|
Megaphone,
|
|
96
97
|
MemoryStick,
|
|
97
98
|
MessageCircle,
|
|
@@ -99,6 +100,7 @@ export const WEB_ICONS = Object.freeze({
|
|
|
99
100
|
MessageSquareText,
|
|
100
101
|
MessagesSquare,
|
|
101
102
|
Mic,
|
|
103
|
+
Minimize2,
|
|
102
104
|
Minus,
|
|
103
105
|
Monitor,
|
|
104
106
|
MonitorSmartphone,
|
|
@@ -126,6 +128,7 @@ export const WEB_ICONS = Object.freeze({
|
|
|
126
128
|
RotateCcw,
|
|
127
129
|
Rows2,
|
|
128
130
|
Save,
|
|
131
|
+
Scan,
|
|
129
132
|
ScanLine,
|
|
130
133
|
ScrollText,
|
|
131
134
|
Search,
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** The conversation a call is with (WebCallPartner.open). */
|
|
2
|
+
export interface WebCallTarget {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
sessionFile?: string;
|
|
5
|
+
cwd?: string;
|
|
6
|
+
/** The conversation of the double, which hands out tasks of its own. */
|
|
7
|
+
double: boolean;
|
|
8
|
+
/** The language the user speaks in the call. */
|
|
9
|
+
language: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Who answers in a call in place of the conversation (WebExtensionAPI.registerCallPartner): a front that talks at
|
|
13
|
+
* once, whatever the conversation does, and hands it the work (docs/design/ta-call.md).
|
|
14
|
+
*/
|
|
15
|
+
export interface WebCallPartner {
|
|
16
|
+
/** Its side of a call with the conversation; undefined to leave the call to the conversation itself. */
|
|
17
|
+
open(target: WebCallTarget): Promise<WebCallSession | undefined>;
|
|
18
|
+
}
|
|
19
|
+
/** A call as its partner answers it, from when it starts until it ends. */
|
|
20
|
+
export interface WebCallSession {
|
|
21
|
+
/** What the user said; the reply to say. `sent`: it went to the conversation already, as it began the call. */
|
|
22
|
+
say(text: string, options?: {
|
|
23
|
+
sent?: boolean;
|
|
24
|
+
}): Promise<string | undefined>;
|
|
25
|
+
/**
|
|
26
|
+
* What the user said so far, as they paused where they may be done: the partner answers it at once, to be said only
|
|
27
|
+
* if they were done (`keep`), dropped as they say more (`drop`), doing nothing until kept (docs/design/ta-call.md
|
|
28
|
+
* 10). Newer than some partners.
|
|
29
|
+
*/
|
|
30
|
+
draft?(text: string): WebCallDraft;
|
|
31
|
+
/** Whether the partner ended the call (asked to hang up): it ends once its last reply is said. */
|
|
32
|
+
ending?(): boolean;
|
|
33
|
+
/** What the partner says by itself (news of the work), asked again and again in a call; undefined after a while. */
|
|
34
|
+
next?(): Promise<string | undefined>;
|
|
35
|
+
close(): void;
|
|
36
|
+
}
|
|
37
|
+
/** An answer begun before the user was known to be done (WebCallSession.draft). */
|
|
38
|
+
export interface WebCallDraft {
|
|
39
|
+
/** The reply to say, as `say` gives it; undefined once dropped. */
|
|
40
|
+
reply: Promise<string | undefined>;
|
|
41
|
+
/** The user was done with these words: its reply is said, and what it does is done. */
|
|
42
|
+
keep(): void;
|
|
43
|
+
/** The user said more: it stops and does nothing. */
|
|
44
|
+
drop(): void;
|
|
45
|
+
}
|
|
@@ -197,6 +197,18 @@ export interface WebPictureCard {
|
|
|
197
197
|
disabled?: boolean;
|
|
198
198
|
onPick(): void;
|
|
199
199
|
}
|
|
200
|
+
/** WebExtensionUI.ChatImages: the pictures of one message. */
|
|
201
|
+
export interface WebChatImagesProps {
|
|
202
|
+
images: readonly {
|
|
203
|
+
key: string;
|
|
204
|
+
src?: string;
|
|
205
|
+
thumb?: string;
|
|
206
|
+
width: number;
|
|
207
|
+
height: number;
|
|
208
|
+
}[];
|
|
209
|
+
/** What they are, for who cannot see them. */
|
|
210
|
+
alt?: string;
|
|
211
|
+
}
|
|
200
212
|
export interface WebImageViewerProps {
|
|
201
213
|
src: string;
|
|
202
214
|
alt?: string;
|
|
@@ -298,8 +310,17 @@ export interface WebVoice {
|
|
|
298
310
|
}
|
|
299
311
|
export interface WebComposerProps {
|
|
300
312
|
placeholder?: string;
|
|
301
|
-
/**
|
|
302
|
-
|
|
313
|
+
/**
|
|
314
|
+
* Sends what was typed, and the pictures added when the box takes them (`images`), the text empty for pictures
|
|
315
|
+
* alone; when it fails, both come back into the box and the reason is a notice of the page.
|
|
316
|
+
*/
|
|
317
|
+
onSend(text: string, images: WebComposerImage[]): Promise<void> | void;
|
|
318
|
+
/**
|
|
319
|
+
* Pictures can be added, as in a conversation: the album and the camera in the + (a picture on a computer), pasted,
|
|
320
|
+
* dropped. With limits, each comes shrunk within them (a JPEG, unless it fits as it is), its size in pixels said.
|
|
321
|
+
* Newer than some Ta apps, which take none.
|
|
322
|
+
*/
|
|
323
|
+
images?: boolean | WebComposerImageLimits;
|
|
303
324
|
/** What `@` lists, by name; and the + menu entry that starts an `@`. */
|
|
304
325
|
mentions?: {
|
|
305
326
|
name: string;
|
|
@@ -335,6 +356,20 @@ export interface WebComposerProps {
|
|
|
335
356
|
*/
|
|
336
357
|
draft?: string;
|
|
337
358
|
}
|
|
359
|
+
/** A picture sent from the message box (WebComposerProps.images): JPEG, PNG, GIF or WebP, in base64. */
|
|
360
|
+
export interface WebComposerImage {
|
|
361
|
+
type: 'image';
|
|
362
|
+
data: string;
|
|
363
|
+
mimeType: string;
|
|
364
|
+
/** In pixels, when the box shrank it (`images` with limits). */
|
|
365
|
+
width?: number;
|
|
366
|
+
height?: number;
|
|
367
|
+
}
|
|
368
|
+
/** How the message box shrinks the pictures it hands on: their longest side in pixels, their bytes at most. */
|
|
369
|
+
export interface WebComposerImageLimits {
|
|
370
|
+
side: number;
|
|
371
|
+
bytes: number;
|
|
372
|
+
}
|
|
338
373
|
/** An entry of the + menu of the message box. */
|
|
339
374
|
export interface WebComposerAction {
|
|
340
375
|
key: string;
|
|
@@ -3,6 +3,7 @@ import type { TaRoomInfo } from '@celljs/ta-protocol';
|
|
|
3
3
|
import type * as React from 'react';
|
|
4
4
|
import type { WebComposerAction } from './web-api-components.js';
|
|
5
5
|
import type { WebIcon } from './web-extension-api.js';
|
|
6
|
+
export type * from './web-api-call.js';
|
|
6
7
|
export type * from './web-api-chats.js';
|
|
7
8
|
/** A conversation as its message box knows it. */
|
|
8
9
|
export interface WebConversation {
|
|
@@ -467,37 +468,6 @@ export interface WebTaskEntry extends WebTask {
|
|
|
467
468
|
/** The name of the extension it is of. */
|
|
468
469
|
extension: string;
|
|
469
470
|
}
|
|
470
|
-
/** pi's custom message, as the conversation holds it. */
|
|
471
|
-
/** The conversation a call is with (WebCallPartner.open). */
|
|
472
|
-
export interface WebCallTarget {
|
|
473
|
-
sessionId: string;
|
|
474
|
-
sessionFile?: string;
|
|
475
|
-
cwd?: string;
|
|
476
|
-
/** The conversation of the double, which hands out tasks of its own. */
|
|
477
|
-
double: boolean;
|
|
478
|
-
/** The language the user speaks in the call. */
|
|
479
|
-
language: string;
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* Who answers in a call in place of the conversation (WebExtensionAPI.registerCallPartner): a front that talks at
|
|
483
|
-
* once, whatever the conversation does, and hands it the work (docs/design/ta-call.md).
|
|
484
|
-
*/
|
|
485
|
-
export interface WebCallPartner {
|
|
486
|
-
/** Its side of a call with the conversation; undefined to leave the call to the conversation itself. */
|
|
487
|
-
open(target: WebCallTarget): Promise<WebCallSession | undefined>;
|
|
488
|
-
}
|
|
489
|
-
/** A call as its partner answers it, from when it starts until it ends. */
|
|
490
|
-
export interface WebCallSession {
|
|
491
|
-
/** What the user said; the reply to say. `sent`: it went to the conversation already, as it began the call. */
|
|
492
|
-
say(text: string, options?: {
|
|
493
|
-
sent?: boolean;
|
|
494
|
-
}): Promise<string | undefined>;
|
|
495
|
-
/** Whether the partner ended the call (asked to hang up): it ends once its last reply is said. */
|
|
496
|
-
ending?(): boolean;
|
|
497
|
-
/** What the partner says by itself (news of the work), asked again and again in a call; undefined after a while. */
|
|
498
|
-
next?(): Promise<string | undefined>;
|
|
499
|
-
close(): void;
|
|
500
|
-
}
|
|
501
471
|
/** What else a code renderer says of its blocks (WebExtensionAPI.registerCodeRenderer). */
|
|
502
472
|
export interface WebCodeRendererOptions {
|
|
503
473
|
/**
|
|
@@ -527,6 +497,7 @@ export interface WebCodeRendererProps {
|
|
|
527
497
|
*/
|
|
528
498
|
answer?: string;
|
|
529
499
|
}
|
|
500
|
+
/** pi's custom message, as the conversation holds it. */
|
|
530
501
|
export interface WebCustomMessage {
|
|
531
502
|
role: 'custom';
|
|
532
503
|
customType: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { WebHomeEntry } from './web-api-contributions.js';
|
|
2
|
+
export type * from './web-api-partners.js';
|
|
2
3
|
/** What the page offers of the rows of the double's home (registerHomeItems), for a list of an extension to show them as its own do. */
|
|
3
4
|
export interface WebHomeUI {
|
|
4
5
|
/** A React hook: the rows extensions add to the double's home (registerHomeItems), in the order they loaded. */
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { WebMenuItem } from './web-api-contributions.js';
|
|
3
|
+
import type { WebIcon } from './web-extension-api.js';
|
|
4
|
+
/**
|
|
5
|
+
* Those the user works with (docs/design/ta-partners.md): an agent, a friend, a group chat. Each is someone (or some
|
|
6
|
+
* ones) with a name and a face, a relation to the user, and one conversation with them; what is said there is a
|
|
7
|
+
* conversation of the double's list, as any other, and the page of the partners lists them, by kind, as contacts.
|
|
8
|
+
*/
|
|
9
|
+
export type WebPartnerKind = 'agent' | 'friend' | 'group';
|
|
10
|
+
/** One the user works with, as the extension that keeps them gives them (WebExtensionAPI.registerPartners). */
|
|
11
|
+
export interface WebPartner {
|
|
12
|
+
/** Unique in the extension: an agent's, a friend's identity, a group chat's. */
|
|
13
|
+
id: string;
|
|
14
|
+
kind: WebPartnerKind;
|
|
15
|
+
name: string;
|
|
16
|
+
/** Drawn `size` wide; else `icon` on a tile of its tint. */
|
|
17
|
+
face?: React.ComponentType<{
|
|
18
|
+
size: number;
|
|
19
|
+
}>;
|
|
20
|
+
icon: WebIcon;
|
|
21
|
+
/** Tints its tile, the same for the same text; default: the extension's name. */
|
|
22
|
+
tint?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Not a partner yet: `asking`, one asks the user (to be a friend, to join a group chat of theirs); `invited`, the
|
|
25
|
+
* user is asked into a group chat; `waiting`, the user asked, the other has not answered. Opening it answers.
|
|
26
|
+
*/
|
|
27
|
+
status?: 'asking' | 'invited' | 'waiting';
|
|
28
|
+
/** What it is, under its name when nothing was said with it: an agent's role, who asks and why. */
|
|
29
|
+
about?: string;
|
|
30
|
+
/** The conversation with it; none before there is one. */
|
|
31
|
+
chat?: WebPartnerChat;
|
|
32
|
+
/** A friend online now: the green dot of a contact. */
|
|
33
|
+
online?: boolean;
|
|
34
|
+
/** A group chat with friends in it, not of the user's agents alone: a small label after its name. */
|
|
35
|
+
friends?: boolean;
|
|
36
|
+
/** Where it works (an agent's directory): a remote one is marked by its host. */
|
|
37
|
+
location?: string;
|
|
38
|
+
/** Opens its conversation (or, while not a partner yet, what to answer). A promise keeps the row busy. */
|
|
39
|
+
open(): unknown;
|
|
40
|
+
/**
|
|
41
|
+
* Opens who it is and its settings, as a messenger's profile of a contact or info of a group: an agent's name, model,
|
|
42
|
+
* role and directory, what a friend may do, a group chat's members. In its menu after Open, and behind its row.
|
|
43
|
+
*/
|
|
44
|
+
info?(): unknown;
|
|
45
|
+
/** What else it does (stop, share, export…), in its menu between Open and {@link remove}. */
|
|
46
|
+
menu?(): WebMenuItem[][];
|
|
47
|
+
/**
|
|
48
|
+
* Takes it off the user's partners (delete an agent, remove a friend, leave a group chat): last in its menu, in red,
|
|
49
|
+
* and behind its row on the page of the partners. It asks the user first itself.
|
|
50
|
+
*/
|
|
51
|
+
remove?: WebMenuItem;
|
|
52
|
+
}
|
|
53
|
+
/** The conversation with a partner. */
|
|
54
|
+
export interface WebPartnerChat {
|
|
55
|
+
/** A conversation of pi (an agent's): the double's list has its row already, this only names whose it is. */
|
|
56
|
+
sessionFile?: string;
|
|
57
|
+
/** What was said last, with who said it where it is not the partner. */
|
|
58
|
+
last?: string;
|
|
59
|
+
/** `Date.now()` time of it: where the conversation is in the double's list. */
|
|
60
|
+
at?: number;
|
|
61
|
+
/** Said since the user last looked: the amber dot. */
|
|
62
|
+
unseen?: boolean;
|
|
63
|
+
/** Answers now: the green dot that breathes. */
|
|
64
|
+
busy?: boolean;
|
|
65
|
+
/** Waits for the user to answer: the blue ?. */
|
|
66
|
+
asks?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Takes the conversation off the double's list, the partner kept (delete a chat of two): behind its row there; without
|
|
69
|
+
* it, the row of a group chat there takes it off with {@link WebPartner.remove}.
|
|
70
|
+
*/
|
|
71
|
+
close?: WebMenuItem;
|
|
72
|
+
}
|
|
73
|
+
/** The partners of an extension (WebExtensionAPI.registerPartners). */
|
|
74
|
+
export interface WebPartnerSource {
|
|
75
|
+
partners(): readonly WebPartner[];
|
|
76
|
+
subscribe(listener: () => void): () => void;
|
|
77
|
+
/** What it adds to the + of the partners, to have a new one: an agent, a friend. */
|
|
78
|
+
add?(): WebMenuItem[];
|
|
79
|
+
/**
|
|
80
|
+
* Starts a group chat of these, two or more of the user's agents and friends (of every extension) the user picked:
|
|
81
|
+
* true once it did, false when it does not make such a group chat (one of the members is none it knows), for the
|
|
82
|
+
* next source to try.
|
|
83
|
+
*/
|
|
84
|
+
group?(members: readonly WebPartnerEntry[]): Promise<boolean>;
|
|
85
|
+
}
|
|
86
|
+
/** What an extension gives of the partners (WebExtensionAPI). */
|
|
87
|
+
export interface WebPartnersAPI {
|
|
88
|
+
/**
|
|
89
|
+
* Those the user works with that the extension keeps (agents, friends, group chats): the page lists them on the
|
|
90
|
+
* page of the partners, and what is said with each among the conversations of the double's list
|
|
91
|
+
* (docs/design/ta-partners.md). Newer than some Ta apps: `pi.registerPartners?.(…)`; without it, an extension shows
|
|
92
|
+
* them itself.
|
|
93
|
+
*/
|
|
94
|
+
registerPartners(source: WebPartnerSource): void;
|
|
95
|
+
}
|
|
96
|
+
/** What the page offers of the partners (WebExtensionUI). */
|
|
97
|
+
export interface WebPartnersUI {
|
|
98
|
+
/**
|
|
99
|
+
* Starts a chat as the + of the partners does: the user picks among their agents and friends, one is the conversation
|
|
100
|
+
* with them, two or more a group chat (WebPartnerSource.group). `partner`, the id of one of this extension's
|
|
101
|
+
* partners picked already (the friend of a chat of two). Newer than some Ta apps: `pi.ui.startGroup?.(…)`.
|
|
102
|
+
*/
|
|
103
|
+
startGroup(partner?: string): void;
|
|
104
|
+
}
|
|
105
|
+
/** A partner as the page lists it. */
|
|
106
|
+
export interface WebPartnerEntry extends WebPartner {
|
|
107
|
+
/** `<extension name>/<id>`. */
|
|
108
|
+
key: string;
|
|
109
|
+
extension: string;
|
|
110
|
+
/** The tint of its tile: `var(--ta-tint-<n>)`, `var(--ta-tint-ink-<n>)`. */
|
|
111
|
+
tone: number;
|
|
112
|
+
}
|
|
@@ -6,10 +6,10 @@ import type { GameProps } from '../game/game-protocol.js';
|
|
|
6
6
|
import type { Game3DProps } from '../game/game3d-protocol.js';
|
|
7
7
|
import type { ScreenPartSpec, TaScreen } from '../screen/screen-protocol.js';
|
|
8
8
|
import type { Language, Theme } from '../settings/settings-protocol.js';
|
|
9
|
-
import type { CodeEditorProps, DiffEditorProps, WebComposerProps, WebConversationViewProps, WebDialogProps, WebEmptyProps, WebFaceProps, WebFolderPickerProps, WebFullScreenProps, WebGroupFaceProps, WebHoldToTalkProps, WebImageViewerProps, WebLoadingProps, WebModelPickerProps, WebPictureCardsProps, WebPictureProps, WebSelectBarProps, WebSelectCheckProps, WebShareSheetProps, WebStackProps, WebSwipeRowProps, WebSwitchProps, WebTaskIconProps, WebVoice } from './web-api-components.js';
|
|
9
|
+
import type { CodeEditorProps, DiffEditorProps, WebChatImagesProps, WebComposerProps, WebConversationViewProps, WebDialogProps, WebEmptyProps, WebFaceProps, WebFolderPickerProps, WebFullScreenProps, WebGroupFaceProps, WebHoldToTalkProps, WebImageViewerProps, WebLoadingProps, WebModelPickerProps, WebPictureCardsProps, WebPictureProps, WebSelectBarProps, WebSelectCheckProps, WebShareSheetProps, WebStackProps, WebSwipeRowProps, WebSwitchProps, WebTaskIconProps, WebVoice } from './web-api-components.js';
|
|
10
10
|
import type { WebAsk, WebCallPartner, WebChatIconSource, WebCodeRendererOptions, WebCodeRendererProps, WebComposerAddon, WebCustomMessage, WebEditor, WebHomeSource, WebInitiative, WebMenuItem, WebOpener, WebOpenerOptions, WebRoomAddon, WebRoomAddonEntry, WebSearchSource, WebSessionMenu, WebSessionNotice, WebSettingsSection, WebShareTarget, WebTaskEntry, WebTaskRemoval, WebTaskSource, WebTool, WebToolRendererResolver, WebView, WebViewInfo, WidgetOptions } from './web-api-contributions.js';
|
|
11
11
|
import type { WebDesktop, WebFileDrag } from './web-api-desktop.js';
|
|
12
|
-
import type { WebHomeUI } from './web-api-home.js';
|
|
12
|
+
import type { WebHomeUI, WebPartnersAPI, WebPartnersUI } from './web-api-home.js';
|
|
13
13
|
import type { WebServices } from './web-api-services.js';
|
|
14
14
|
import type { WebTerminal, WebTerminalOptions } from './web-api-terminal.js';
|
|
15
15
|
import type { WebPageInfo } from './web-pages.js';
|
|
@@ -31,7 +31,7 @@ export type { WebPageInfo, WebPageState } from './web-pages.js';
|
|
|
31
31
|
* the two mean the same. A web extension is one ES module without imports, the `web` part of a pi
|
|
32
32
|
* package (see TaWebExtensionInfo); it exports a {@link WebExtensionFactory}.
|
|
33
33
|
*/
|
|
34
|
-
export interface WebExtensionAPI extends WebServices {
|
|
34
|
+
export interface WebExtensionAPI extends WebServices, WebPartnersAPI {
|
|
35
35
|
/** The React of the page: an extension brings no React of its own. */
|
|
36
36
|
readonly React: typeof React;
|
|
37
37
|
readonly ui: WebExtensionUI;
|
|
@@ -230,7 +230,7 @@ export interface WebNotifyOptions {
|
|
|
230
230
|
export type { ScreenAction, ScreenItem, ScreenPartSpec, ScreenPartView, ScreenPlace, ScreenScrollable, ScreenScrollTo } from '../screen/screen-protocol.js';
|
|
231
231
|
/** What web extensions see of TaScreen. */
|
|
232
232
|
export type WebScreen = Pick<TaScreen, 'agent' | 'parts' | 'act' | 'element' | 'where' | 'places' | 'go' | 'pageScroll' | 'scroll'>;
|
|
233
|
-
export interface WebExtensionUI extends WebHomeUI {
|
|
233
|
+
export interface WebExtensionUI extends WebHomeUI, WebPartnersUI {
|
|
234
234
|
/** A widget around the message box, as pi's, or a card in the workbench on the right; `undefined` removes it. */
|
|
235
235
|
setWidget(key: string, widget: React.ComponentType | undefined, options?: WidgetOptions): void;
|
|
236
236
|
/**
|
|
@@ -322,10 +322,7 @@ export interface WebExtensionUI extends WebHomeUI {
|
|
|
322
322
|
closeEditor(id: string): void;
|
|
323
323
|
/** Keeps a tab opened as a preview: the next preview opens beside it. */
|
|
324
324
|
pinEditor(id: string): void;
|
|
325
|
-
/**
|
|
326
|
-
* Marks a tab as changed and not saved: a dot in place of its close button, and the user is asked
|
|
327
|
-
* before closing it. Dirty tabs are pinned.
|
|
328
|
-
*/
|
|
325
|
+
/** Marks a tab as changed and not saved: a dot in place of its close button, and the user is asked before closing it. Dirty tabs are pinned. */
|
|
329
326
|
setEditorDirty(id: string, dirty: boolean): void;
|
|
330
327
|
/** A React hook: the id of the tab shown in the workbench, whoever opened it. */
|
|
331
328
|
useActiveEditor(): string | undefined;
|
|
@@ -593,9 +590,8 @@ export interface WebExtensionUI extends WebHomeUI {
|
|
|
593
590
|
readonly SelectCheck: React.ComponentType<WebSelectCheckProps>;
|
|
594
591
|
readonly SelectBar: React.ComponentType<WebSelectBarProps>;
|
|
595
592
|
/**
|
|
596
|
-
* The face of a task, as every list of tasks draws it: who does it (`WebTask.icon`), else its glyph on the tile
|
|
597
|
-
*
|
|
598
|
-
* `pi.ui.TaskIcon ?? fallback`.
|
|
593
|
+
* The face of a task, as every list of tasks draws it: who does it (`WebTask.icon`), else its glyph on the tile of tasks, a rounded
|
|
594
|
+
* square tinted green while it goes on and grey once it ended. Newer than some Ta apps: `pi.ui.TaskIcon ?? fallback`.
|
|
599
595
|
*/
|
|
600
596
|
readonly TaskIcon: React.ComponentType<WebTaskIconProps>;
|
|
601
597
|
/** A small picture as the pictures of Ta: an SVG whose shapes take the classes `ta-pic-*` (WebPictureProps). */
|
|
@@ -603,12 +599,13 @@ export interface WebExtensionUI extends WebHomeUI {
|
|
|
603
599
|
/** Choices as pictures in a row, as the suggestions of an empty conversation: a click picks one. */
|
|
604
600
|
readonly PictureCards: React.ComponentType<WebPictureCardsProps>;
|
|
605
601
|
/**
|
|
606
|
-
* A picture to look at closely, as the viewers of pictures: all of it at first (never larger than its own
|
|
607
|
-
*
|
|
608
|
-
*
|
|
609
|
-
* pictures beside it at its sides when given (`onPrevious` / `onNext`). It fills its parent (a column of flex).
|
|
602
|
+
* A picture to look at closely, as the viewers of pictures: all of it at first (never larger than its own pixels), pinched by two fingers
|
|
603
|
+
* or a trackpad, zoomed by a wheel with Ctrl or ⌘ and by a double tap or click, dragged or scrolled once zoomed; with − / the scale / + /
|
|
604
|
+
* fit / actual size below it, and the pictures beside it at its sides when given (`onPrevious` / `onNext`). It fills its parent (a column of flex).
|
|
610
605
|
*/
|
|
611
606
|
readonly ImageViewer: React.ComponentType<WebImageViewerProps>;
|
|
607
|
+
/** The pictures of a message of a chat the extension draws, as a conversation shows the user's (`thumb` blurred till `src`). Newer than some apps. */
|
|
608
|
+
readonly ChatImages?: React.ComponentType<WebChatImagesProps>;
|
|
612
609
|
/** A QR code of a text (a link to scan with a phone), black on white whatever the theme; `label` for a screen reader. */
|
|
613
610
|
readonly QrCode: React.ComponentType<{
|
|
614
611
|
text: string;
|
|
@@ -40,9 +40,8 @@ export interface WebExtensionContextHost {
|
|
|
40
40
|
switcher(): WebSessionSwitcher | undefined;
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
|
-
* The API each web extension gets: what it registers is its own and goes when it stops, and once it stopped
|
|
44
|
-
*
|
|
45
|
-
* no, and what would act for the user (send a message, switch the conversation, open or reload packages) fails.
|
|
43
|
+
* The API each web extension gets: what it registers is its own and goes when it stops, and once it stopped (turned off, removed,
|
|
44
|
+
* a timer of it left behind) it neither shows nor does anything more: its dialogs answer no, and what would act for the user fails.
|
|
46
45
|
*/
|
|
47
46
|
export declare class WebExtensionContext {
|
|
48
47
|
protected readonly host: WebExtensionContextHost;
|
|
@@ -20,6 +20,7 @@ import { HostTag } from '../components/host-tag.js';
|
|
|
20
20
|
import { ImageViewer } from '../components/image-viewer.js';
|
|
21
21
|
import { Loading } from '../components/loading.js';
|
|
22
22
|
import { Markdown } from '../components/markdown.js';
|
|
23
|
+
import { ChatImages } from '../components/message-images.js';
|
|
23
24
|
import { SettingsModelPicker } from '../components/model-picker.js';
|
|
24
25
|
import { PhoneStack } from '../components/phone-shell.js';
|
|
25
26
|
import { Picture, PictureCards } from '../components/picture.js';
|
|
@@ -51,9 +52,8 @@ import { WebPagesUtil } from './web-pages.js';
|
|
|
51
52
|
import { WebTaskUtil } from './web-tasks.js';
|
|
52
53
|
const FILE_DRAG = Object.freeze({ set: FileDragUtil.set, has: FileDragUtil.has, get: FileDragUtil.get, paths: FileDragUtil.paths });
|
|
53
54
|
/**
|
|
54
|
-
* The API each web extension gets: what it registers is its own and goes when it stops, and once it stopped
|
|
55
|
-
*
|
|
56
|
-
* no, and what would act for the user (send a message, switch the conversation, open or reload packages) fails.
|
|
55
|
+
* The API each web extension gets: what it registers is its own and goes when it stops, and once it stopped (turned off, removed,
|
|
56
|
+
* a timer of it left behind) it neither shows nor does anything more: its dialogs answer no, and what would act for the user fails.
|
|
57
57
|
*/
|
|
58
58
|
export class WebExtensionContext {
|
|
59
59
|
constructor(host) {
|
|
@@ -215,6 +215,7 @@ export class WebExtensionContext {
|
|
|
215
215
|
registerToolRenderer: resolver => register(() => run.toolRenderers.push(resolver)),
|
|
216
216
|
registerTasks: source => register(() => run.taskSources.push(source)),
|
|
217
217
|
registerHomeItems: source => register(() => run.homeSources.push(source)),
|
|
218
|
+
registerPartners: source => register(() => run.partnerSources.push(source)),
|
|
218
219
|
registerInitiative: initiative => register(() => run.initiatives.push(initiative)),
|
|
219
220
|
registerSearch: source => register(() => run.searches.push(source)),
|
|
220
221
|
registerComposerAddon: addon => register(() => run.composerAddons.push(addon)),
|
|
@@ -392,8 +393,7 @@ export class WebExtensionContext {
|
|
|
392
393
|
}
|
|
393
394
|
},
|
|
394
395
|
forgetPage: id => !run.stopped && host.extensions.forgetPage(id),
|
|
395
|
-
|
|
396
|
-
...WebHomeUtil.ui(host.extensions, () => run.stopped),
|
|
396
|
+
...WebHomeUtil.ui(host.extensions, () => run.stopped, run.loaded.name),
|
|
397
397
|
doubleInChats: true,
|
|
398
398
|
useRoomAddons: () => {
|
|
399
399
|
const read = () => host.extensions.state.roomAddons;
|
|
@@ -440,6 +440,7 @@ export class WebExtensionContext {
|
|
|
440
440
|
Picture,
|
|
441
441
|
PictureCards,
|
|
442
442
|
ImageViewer,
|
|
443
|
+
ChatImages,
|
|
443
444
|
QrCode: QrView,
|
|
444
445
|
ShareSheet: this.shareSheet,
|
|
445
446
|
Dialog: WebDialog,
|
|
@@ -455,9 +456,8 @@ export class WebExtensionContext {
|
|
|
455
456
|
const isShown = () => host.isShown(id);
|
|
456
457
|
const view = React.useSyncExternalStore(subscribe, find, find);
|
|
457
458
|
const shown = React.useSyncExternalStore(subscribe, isShown, isShown);
|
|
458
|
-
// The title
|
|
459
|
+
// The title (read again in another language) and the preview as strings, so that the same words stay the same value.
|
|
459
460
|
const title = view ? WebLabelUtil.text(view.title) : undefined;
|
|
460
|
-
// The preview as one string, so that the same line stays the same value.
|
|
461
461
|
const watch = React.useCallback((listener) => { var _a; var _b; return (_b = (_a = view === null || view === void 0 ? void 0 : view.subscribePreview) === null || _a === void 0 ? void 0 : _a.call(view, listener)) !== null && _b !== void 0 ? _b : (() => undefined); }, [view]);
|
|
462
462
|
const read = () => {
|
|
463
463
|
var _a;
|