@celljs/ta-web 4.11.0 → 4.13.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/README.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/assistant/assistant-extension.js +14 -0
- package/esm/browser/assistant/assistant-initiative.d.ts +27 -0
- package/esm/browser/assistant/assistant-initiative.js +76 -0
- package/esm/browser/assistant/assistant-task-source.d.ts +7 -0
- package/esm/browser/assistant/assistant-task-source.js +12 -2
- package/esm/browser/assistant/assistant-view.js +10 -6
- package/esm/browser/assistant/assistant.d.ts +5 -0
- package/esm/browser/assistant/assistant.js +25 -6
- package/esm/browser/chat/chat-view.js +6 -5
- package/esm/browser/components/app-nav.d.ts +3 -1
- package/esm/browser/components/app-nav.js +5 -2
- package/esm/browser/components/app-view.js +26 -13
- package/esm/browser/components/asks-badge.d.ts +5 -0
- package/esm/browser/components/asks-badge.js +8 -0
- package/esm/browser/components/chat-asks.d.ts +46 -0
- package/esm/browser/components/chat-asks.js +101 -0
- package/esm/browser/components/chat-list.d.ts +7 -1
- package/esm/browser/components/chat-list.js +46 -17
- package/esm/browser/components/composer-addon-util.d.ts +11 -0
- package/esm/browser/components/composer-addon-util.js +40 -0
- package/esm/browser/components/composer-addons.d.ts +1 -7
- package/esm/browser/components/composer-addons.js +1 -27
- package/esm/browser/components/composer-box.d.ts +1 -0
- package/esm/browser/components/composer-box.js +50 -28
- package/esm/browser/components/composer.d.ts +10 -1
- package/esm/browser/components/composer.js +61 -22
- package/esm/browser/components/connection-bar.js +31 -12
- package/esm/browser/components/conversation-scroll-hooks.d.ts +16 -0
- package/esm/browser/components/conversation-scroll-hooks.js +98 -0
- package/esm/browser/components/conversation-scroll-util.d.ts +35 -0
- package/esm/browser/components/conversation-scroll-util.js +74 -0
- package/esm/browser/components/conversation-scroll.d.ts +57 -33
- package/esm/browser/components/conversation-scroll.js +188 -123
- package/esm/browser/components/discover-view.js +5 -1
- package/esm/browser/components/earlier-messages.d.ts +10 -3
- package/esm/browser/components/earlier-messages.js +14 -8
- package/esm/browser/components/face.d.ts +24 -0
- package/esm/browser/components/face.js +42 -0
- package/esm/browser/components/folder-picker.d.ts +2 -0
- package/esm/browser/components/folder-picker.js +7 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/markdown.js +4 -2
- package/esm/browser/components/media.js +25 -11
- package/esm/browser/components/mermaid-view.js +45 -3
- package/esm/browser/components/message-actions.js +1 -0
- package/esm/browser/components/message-footer.d.ts +4 -0
- package/esm/browser/components/message-footer.js +8 -1
- package/esm/browser/components/message-list.d.ts +15 -1
- package/esm/browser/components/message-list.js +204 -41
- package/esm/browser/components/phone-shell.d.ts +7 -2
- package/esm/browser/components/phone-shell.js +9 -3
- package/esm/browser/components/relay-services.d.ts +24 -0
- package/esm/browser/components/relay-services.js +249 -0
- package/esm/browser/components/relay-view.js +17 -1
- package/esm/browser/components/remote-hosts.js +1 -1
- package/esm/browser/components/session-view.d.ts +3 -1
- package/esm/browser/components/session-view.js +23 -7
- package/esm/browser/components/settings-controls.js +3 -3
- package/esm/browser/components/settings-parts.js +13 -1
- package/esm/browser/components/stop-times.d.ts +47 -0
- package/esm/browser/components/stop-times.js +81 -0
- package/esm/browser/components/ta-avatar.js +6 -0
- package/esm/browser/components/tool-result.d.ts +13 -0
- package/esm/browser/components/tool-result.js +138 -0
- package/esm/browser/components/tool-view.js +5 -15
- package/esm/browser/components/use-stop-times.d.ts +3 -0
- package/esm/browser/components/use-stop-times.js +17 -0
- package/esm/browser/components/web-composer.js +2 -1
- package/esm/browser/device/photo-picker.d.ts +14 -0
- package/esm/browser/device/photo-picker.js +48 -0
- package/esm/browser/device/row-swipe.d.ts +2 -0
- package/esm/browser/device/row-swipe.js +8 -2
- package/esm/browser/device/sheet-swipe.d.ts +1 -1
- package/esm/browser/device/sheet-swipe.js +17 -3
- package/esm/browser/extension/extension-view.d.ts +3 -1
- package/esm/browser/extension/extension-view.js +7 -0
- package/esm/browser/extension/icons.js +10 -1
- package/esm/browser/extension/web-api-components.d.ts +21 -3
- package/esm/browser/extension/web-api-contributions.d.ts +128 -0
- package/esm/browser/extension/web-extension-api.d.ts +45 -48
- package/esm/browser/extension/web-extension-context.d.ts +6 -1
- package/esm/browser/extension/web-extension-context.js +72 -7
- package/esm/browser/extension/web-extension-protocol.d.ts +18 -2
- package/esm/browser/extension/web-extension-protocol.js +2 -0
- package/esm/browser/extension/web-extension-run.d.ts +3 -2
- package/esm/browser/extension/web-extension-run.js +3 -0
- package/esm/browser/extension/web-extensions.d.ts +2 -8
- package/esm/browser/extension/web-extensions.js +12 -35
- package/esm/browser/extension/web-page-list.d.ts +25 -0
- package/esm/browser/extension/web-page-list.js +35 -0
- package/esm/browser/extension/web-session-notices.d.ts +6 -1
- package/esm/browser/extension/web-session-notices.js +30 -4
- package/esm/browser/extension/web-sharing.d.ts +5 -2
- package/esm/browser/extension/web-sharing.js +10 -1
- package/esm/browser/i18n/locales.d.ts +77 -1
- package/esm/browser/i18n/messages.d.ts +76 -0
- package/esm/browser/i18n/messages.js +154 -2
- package/esm/browser/links/links-protocol.d.ts +2 -0
- package/esm/browser/links/links.d.ts +7 -2
- package/esm/browser/links/links.js +16 -9
- package/esm/browser/markdown/code-renderers.d.ts +4 -0
- package/esm/browser/markdown/code-renderers.js +4 -0
- package/esm/browser/markdown/lazy.d.ts +8 -0
- package/esm/browser/markdown/lazy.js +35 -0
- package/esm/browser/markdown/mermaid.d.ts +15 -3
- package/esm/browser/markdown/mermaid.js +45 -6
- package/esm/browser/notices/notices-protocol.d.ts +5 -0
- package/esm/browser/notices/notices.d.ts +19 -0
- package/esm/browser/notices/notices.js +85 -2
- package/esm/browser/notices/session-notices.d.ts +5 -2
- package/esm/browser/notices/session-notices.js +10 -1
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +2 -1
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +53 -0
- package/esm/browser/style/device.js +3 -0
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +27 -9
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +5 -0
- package/esm/browser/style/phone.d.ts +1 -1
- package/esm/browser/style/phone.js +2 -0
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +16 -3
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +19 -0
- package/esm/browser/util/desktop.d.ts +18 -1
- package/esm/browser/util/desktop.js +13 -0
- package/esm/browser/util/frame.d.ts +2 -0
- package/esm/browser/util/frame.js +2 -0
- package/esm/browser/util/process.d.ts +69 -2
- package/esm/browser/util/process.js +163 -8
- package/esm/browser/util/progress.d.ts +6 -1
- package/esm/browser/util/progress.js +11 -2
- package/esm/browser/util/scroll-rest.d.ts +10 -0
- package/esm/browser/util/scroll-rest.js +44 -0
- package/esm/browser/util/tool-result.d.ts +32 -0
- package/esm/browser/util/tool-result.js +85 -0
- package/esm/browser/util/tool.js +7 -0
- package/lib/browser/assistant/assistant-extension.js +14 -0
- package/lib/browser/assistant/assistant-initiative.d.ts +28 -0
- package/lib/browser/assistant/assistant-initiative.js +80 -0
- package/lib/browser/assistant/assistant-task-source.d.ts +7 -0
- package/lib/browser/assistant/assistant-task-source.js +12 -2
- package/lib/browser/assistant/assistant-view.js +8 -4
- package/lib/browser/assistant/assistant.d.ts +5 -0
- package/lib/browser/assistant/assistant.js +24 -5
- package/lib/browser/chat/chat-view.js +6 -5
- package/lib/browser/components/app-nav.d.ts +3 -1
- package/lib/browser/components/app-nav.js +5 -2
- package/lib/browser/components/app-view.js +25 -12
- package/lib/browser/components/asks-badge.d.ts +6 -0
- package/lib/browser/components/asks-badge.js +44 -0
- package/lib/browser/components/chat-asks.d.ts +47 -0
- package/lib/browser/components/chat-asks.js +104 -0
- package/lib/browser/components/chat-list.d.ts +7 -1
- package/lib/browser/components/chat-list.js +46 -17
- package/lib/browser/components/composer-addon-util.d.ts +12 -0
- package/lib/browser/components/composer-addon-util.js +76 -0
- package/lib/browser/components/composer-addons.d.ts +1 -7
- package/lib/browser/components/composer-addons.js +2 -29
- package/lib/browser/components/composer-box.d.ts +1 -0
- package/lib/browser/components/composer-box.js +48 -26
- package/lib/browser/components/composer.d.ts +10 -1
- package/lib/browser/components/composer.js +61 -21
- package/lib/browser/components/connection-bar.js +30 -11
- package/lib/browser/components/conversation-scroll-hooks.d.ts +17 -0
- package/lib/browser/components/conversation-scroll-hooks.js +135 -0
- package/lib/browser/components/conversation-scroll-util.d.ts +36 -0
- package/lib/browser/components/conversation-scroll-util.js +78 -0
- package/lib/browser/components/conversation-scroll.d.ts +57 -33
- package/lib/browser/components/conversation-scroll.js +189 -158
- package/lib/browser/components/discover-view.js +5 -1
- package/lib/browser/components/earlier-messages.d.ts +10 -3
- package/lib/browser/components/earlier-messages.js +16 -9
- package/lib/browser/components/face.d.ts +25 -0
- package/lib/browser/components/face.js +79 -0
- package/lib/browser/components/folder-picker.d.ts +2 -0
- package/lib/browser/components/folder-picker.js +7 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/markdown.js +3 -1
- package/lib/browser/components/media.js +24 -10
- package/lib/browser/components/mermaid-view.js +45 -3
- package/lib/browser/components/message-actions.js +1 -0
- package/lib/browser/components/message-footer.d.ts +4 -0
- package/lib/browser/components/message-footer.js +8 -0
- package/lib/browser/components/message-list.d.ts +15 -1
- package/lib/browser/components/message-list.js +200 -35
- package/lib/browser/components/phone-shell.d.ts +7 -2
- package/lib/browser/components/phone-shell.js +9 -3
- package/lib/browser/components/relay-services.d.ts +25 -0
- package/lib/browser/components/relay-services.js +286 -0
- package/lib/browser/components/relay-view.js +17 -1
- package/lib/browser/components/remote-hosts.js +1 -1
- package/lib/browser/components/session-view.d.ts +3 -1
- package/lib/browser/components/session-view.js +23 -7
- package/lib/browser/components/settings-controls.js +3 -3
- package/lib/browser/components/settings-parts.js +13 -1
- package/lib/browser/components/stop-times.d.ts +48 -0
- package/lib/browser/components/stop-times.js +85 -0
- package/lib/browser/components/ta-avatar.js +6 -0
- package/lib/browser/components/tool-result.d.ts +14 -0
- package/lib/browser/components/tool-result.js +175 -0
- package/lib/browser/components/tool-view.js +10 -20
- package/lib/browser/components/use-stop-times.d.ts +4 -0
- package/lib/browser/components/use-stop-times.js +53 -0
- package/lib/browser/components/web-composer.js +2 -1
- package/lib/browser/device/photo-picker.d.ts +15 -0
- package/lib/browser/device/photo-picker.js +51 -0
- package/lib/browser/device/row-swipe.d.ts +2 -0
- package/lib/browser/device/row-swipe.js +8 -2
- package/lib/browser/device/sheet-swipe.d.ts +1 -1
- package/lib/browser/device/sheet-swipe.js +17 -3
- package/lib/browser/extension/extension-view.d.ts +3 -1
- package/lib/browser/extension/extension-view.js +8 -1
- package/lib/browser/extension/icons.js +9 -0
- package/lib/browser/extension/web-api-components.d.ts +21 -3
- package/lib/browser/extension/web-api-contributions.d.ts +128 -0
- package/lib/browser/extension/web-extension-api.d.ts +45 -48
- package/lib/browser/extension/web-extension-context.d.ts +6 -1
- package/lib/browser/extension/web-extension-context.js +73 -8
- package/lib/browser/extension/web-extension-protocol.d.ts +18 -2
- package/lib/browser/extension/web-extension-protocol.js +2 -0
- package/lib/browser/extension/web-extension-run.d.ts +3 -2
- package/lib/browser/extension/web-extension-run.js +3 -0
- package/lib/browser/extension/web-extensions.d.ts +2 -8
- package/lib/browser/extension/web-extensions.js +12 -35
- package/lib/browser/extension/web-page-list.d.ts +26 -0
- package/lib/browser/extension/web-page-list.js +39 -0
- package/lib/browser/extension/web-session-notices.d.ts +6 -1
- package/lib/browser/extension/web-session-notices.js +30 -4
- package/lib/browser/extension/web-sharing.d.ts +5 -2
- package/lib/browser/extension/web-sharing.js +10 -1
- package/lib/browser/i18n/locales.d.ts +77 -1
- package/lib/browser/i18n/messages.d.ts +76 -0
- package/lib/browser/i18n/messages.js +154 -2
- package/lib/browser/links/links-protocol.d.ts +2 -0
- package/lib/browser/links/links.d.ts +7 -2
- package/lib/browser/links/links.js +16 -9
- package/lib/browser/markdown/code-renderers.d.ts +4 -0
- package/lib/browser/markdown/code-renderers.js +5 -1
- package/lib/browser/markdown/lazy.d.ts +8 -0
- package/lib/browser/markdown/lazy.js +37 -1
- package/lib/browser/markdown/mermaid.d.ts +15 -3
- package/lib/browser/markdown/mermaid.js +44 -5
- package/lib/browser/notices/notices-protocol.d.ts +5 -0
- package/lib/browser/notices/notices.d.ts +19 -0
- package/lib/browser/notices/notices.js +84 -1
- package/lib/browser/notices/session-notices.d.ts +5 -2
- package/lib/browser/notices/session-notices.js +10 -1
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +2 -1
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +53 -0
- package/lib/browser/style/device.js +3 -0
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +27 -9
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +5 -0
- package/lib/browser/style/phone.d.ts +1 -1
- package/lib/browser/style/phone.js +2 -0
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +16 -3
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +19 -0
- package/lib/browser/util/desktop.d.ts +18 -1
- package/lib/browser/util/desktop.js +13 -0
- package/lib/browser/util/frame.d.ts +2 -0
- package/lib/browser/util/frame.js +2 -0
- package/lib/browser/util/process.d.ts +69 -2
- package/lib/browser/util/process.js +165 -9
- package/lib/browser/util/progress.d.ts +6 -1
- package/lib/browser/util/progress.js +11 -2
- package/lib/browser/util/scroll-rest.d.ts +11 -0
- package/lib/browser/util/scroll-rest.js +47 -0
- package/lib/browser/util/tool-result.d.ts +33 -0
- package/lib/browser/util/tool-result.js +88 -0
- package/lib/browser/util/tool.js +7 -0
- package/package.json +7 -7
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import { TaImageNote, TaImageSize, TaMessageContext, TaSkillUse } from '@celljs/ta-protocol';
|
|
2
|
-
import { ChevronRight, CircleAlert, Sparkles } from 'lucide-react';
|
|
1
|
+
import { TaImageNote, TaImageSize, TaMessageContext, TaMessageSource, TaPackageTextUtil, TaSkillUse, } from '@celljs/ta-protocol';
|
|
2
|
+
import { Bot, ChevronRight, CircleAlert, Clock3, CornerDownRight, FoldVertical, Puzzle, Sparkles } from 'lucide-react';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { CustomMessage, ExtensionBoundary, MessageRenderers, SessionAvatars } from '../extension/extension-view.js';
|
|
5
|
-
import {
|
|
4
|
+
import { CustomMessage, ExtensionBoundary, LoadedExtensions, MessageRenderers, SessionAvatars } from '../extension/extension-view.js';
|
|
5
|
+
import { WEB_ICONS } from '../extension/icons.js';
|
|
6
|
+
import { useLanguage, useT } from '../i18n/use-t.js';
|
|
7
|
+
import { CodeAnswer, CodeRenderers } from '../markdown/code-renderers.js';
|
|
6
8
|
import { Recent } from '../markdown/lazy.js';
|
|
7
9
|
import { MessageUtil } from '../util/message.js';
|
|
8
|
-
import { ProcessUtil } from '../util/process.js';
|
|
10
|
+
import { FreshRows, ProcessUtil } from '../util/process.js';
|
|
11
|
+
import { ProgressUtil } from '../util/progress.js';
|
|
9
12
|
import { ToolUtil } from '../util/tool.js';
|
|
10
13
|
import { Callout } from './callout.js';
|
|
11
14
|
import { ASK_CLASS } from './conversation-scroll.js';
|
|
12
15
|
import { Icon } from './icon.js';
|
|
13
16
|
import { Lightbox } from './lightbox.js';
|
|
14
17
|
import { Markdown } from './markdown.js';
|
|
15
|
-
import { ModelBreak, TimeBreak, TurnFooter, UserFooter } from './message-footer.js';
|
|
18
|
+
import { MessageActions, ModelBreak, TimeBreak, TurnFooter, UserFooter } from './message-footer.js';
|
|
16
19
|
import { useMessageMenu } from './message-menu.js';
|
|
17
20
|
import { RunStatus } from './run-status.js';
|
|
18
21
|
import { SaidText } from './said-text.js';
|
|
@@ -177,7 +180,37 @@ export function UserSaid({ blocks, text, bubble = 'ta-bubble', timestamp }) {
|
|
|
177
180
|
React.createElement(UserImages, { blocks: blocks, timestamp: timestamp }),
|
|
178
181
|
text && React.createElement(SaidText, { text: text, className: "ta-bubble-text" })));
|
|
179
182
|
}
|
|
180
|
-
|
|
183
|
+
/**
|
|
184
|
+
* Where a message of the user came from when not from what they typed (TaMessageSource): the package that sent it, as
|
|
185
|
+
* the user calls it, with what it says besides (the channel and who spoke); the double. None for what they typed.
|
|
186
|
+
*/
|
|
187
|
+
export function MessageOrigin({ blocks }) {
|
|
188
|
+
var _a;
|
|
189
|
+
var _b;
|
|
190
|
+
const t = useT();
|
|
191
|
+
const language = useLanguage();
|
|
192
|
+
const extensions = React.useContext(LoadedExtensions);
|
|
193
|
+
const source = TaMessageSource.of(MessageUtil.text(blocks));
|
|
194
|
+
if (!source) {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
const info = (_a = extensions.find(extension => extension.name === source.from)) === null || _a === void 0 ? void 0 : _a.info;
|
|
198
|
+
const double = source.from === TaMessageSource.DOUBLE;
|
|
199
|
+
const name = double ? t('ta.assistant.me') : ((_b = TaPackageTextUtil.pick(info === null || info === void 0 ? void 0 : info.title, language)) !== null && _b !== void 0 ? _b : source.from.replace(/^@[^/]+\//, ''));
|
|
200
|
+
const glyph = double ? Bot : ((info === null || info === void 0 ? void 0 : info.icon) && WEB_ICONS[info.icon]) || Puzzle;
|
|
201
|
+
return (React.createElement("span", { className: "ta-origin", title: source.from },
|
|
202
|
+
React.createElement(Icon, { icon: glyph, size: 12 }),
|
|
203
|
+
React.createElement("span", { className: "ta-origin-name" }, name),
|
|
204
|
+
source.detail && React.createElement("span", { className: "ta-origin-detail" }, source.detail)));
|
|
205
|
+
}
|
|
206
|
+
/** Written while the agent was at its reply, sent once it answered (MessageItem.queued). */
|
|
207
|
+
function QueuedMark() {
|
|
208
|
+
const t = useT();
|
|
209
|
+
return (React.createElement("span", { className: "ta-origin ta-origin-queued", title: t('ta.message.queuedTitle') },
|
|
210
|
+
React.createElement(Icon, { icon: Clock3, size: 12 }),
|
|
211
|
+
React.createElement("span", { className: "ta-origin-name" }, t('ta.message.queued'))));
|
|
212
|
+
}
|
|
213
|
+
function UserMessage({ message, queued }) {
|
|
181
214
|
const blocks = MessageUtil.blocks(message);
|
|
182
215
|
const said = MessageUtil.text(blocks).trim();
|
|
183
216
|
if (TASK_RENAMED.test(said)) {
|
|
@@ -189,7 +222,7 @@ function UserMessage({ message }) {
|
|
|
189
222
|
return React.createElement(TaskUpdate, { title: update[1], status: update[2], result: update[3] });
|
|
190
223
|
}
|
|
191
224
|
const { text, copied, skill } = userWords(blocks);
|
|
192
|
-
return React.createElement(UserBubble, { message: message, blocks: blocks, text: text, copied: copied, skill: skill });
|
|
225
|
+
return React.createElement(UserBubble, { message: message, blocks: blocks, text: text, copied: copied, skill: skill, queued: queued });
|
|
193
226
|
}
|
|
194
227
|
/**
|
|
195
228
|
* What a message of the user's shows, in a conversation and the double alike: without the context and the notes of
|
|
@@ -216,17 +249,30 @@ export function SkillUse({ skill }) {
|
|
|
216
249
|
open && (React.createElement("div", { className: "ta-skill-body" },
|
|
217
250
|
React.createElement(Markdown, { text: skill.content.replace(SKILL_BASE, '') })))));
|
|
218
251
|
}
|
|
219
|
-
|
|
252
|
+
/** Above a message of the user: where it came from, and that it waited for a reply; nothing for one typed and sent at once. */
|
|
253
|
+
export function UserMarks({ blocks, queued }) {
|
|
254
|
+
const origin = React.createElement(MessageOrigin, { blocks: blocks });
|
|
255
|
+
if (!queued && !TaMessageSource.of(MessageUtil.text(blocks))) {
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
return (React.createElement("div", { className: "ta-user-marks" },
|
|
259
|
+
origin,
|
|
260
|
+
queued && React.createElement(QueuedMark, null)));
|
|
261
|
+
}
|
|
262
|
+
function UserBubble({ message, blocks, text, copied, skill, queued, }) {
|
|
220
263
|
const [menu, onContextMenu] = useMessageMenu({ kind: 'user', message, text: copied });
|
|
264
|
+
const marks = React.createElement(UserMarks, { blocks: blocks, queued: queued });
|
|
221
265
|
const outbox = React.useContext(Outbox);
|
|
222
266
|
const sent = outbox.of.get(message);
|
|
223
267
|
if (sent) {
|
|
224
268
|
// Not in the session yet: nothing to branch from or rewind to.
|
|
225
269
|
return (React.createElement("div", { className: `ta-message ta-user ${sent.failed ? 'ta-user-failed' : 'ta-user-sending'}` },
|
|
270
|
+
marks,
|
|
226
271
|
React.createElement(UserSaid, { blocks: blocks, text: text, timestamp: message.timestamp }),
|
|
227
272
|
sent.failed ? React.createElement(SendFailed, { sent: sent, actions: outbox.actions }) : React.createElement("div", { className: "ta-footer" })));
|
|
228
273
|
}
|
|
229
274
|
return (React.createElement("div", { className: "ta-message ta-user", onContextMenu: onContextMenu },
|
|
275
|
+
marks,
|
|
230
276
|
skill && React.createElement(SkillUse, { skill: skill }),
|
|
231
277
|
React.createElement(UserSaid, { blocks: blocks, text: text, timestamp: message.timestamp }),
|
|
232
278
|
React.createElement(UserFooter, { message: message, text: copied }),
|
|
@@ -254,20 +300,51 @@ const SummaryStep = React.memo(function SummaryStep({ text }) {
|
|
|
254
300
|
React.createElement(Icon, { icon: ChevronRight, size: 14, className: "ta-step-chevron" })),
|
|
255
301
|
open && React.createElement("div", { className: "ta-thinking-text" }, text)));
|
|
256
302
|
});
|
|
257
|
-
|
|
303
|
+
/** A request that failed on the way, the work going on after it: one quiet line, which opens to the error. */
|
|
304
|
+
const ErrorStep = React.memo(function ErrorStep({ text }) {
|
|
305
|
+
const t = useT();
|
|
306
|
+
const [open, setOpen] = React.useState(false);
|
|
307
|
+
return (React.createElement("div", { className: "ta-step-thinking ta-step-error" },
|
|
308
|
+
React.createElement("button", { type: "button", className: "ta-step-toggle", "aria-expanded": open, onClick: () => setOpen(!open) },
|
|
309
|
+
React.createElement("span", { className: "ta-status ta-status-error" }),
|
|
310
|
+
React.createElement("span", { className: "ta-step-tag" }, t('ta.process.requestFailed')),
|
|
311
|
+
!open && text && React.createElement("span", { className: "ta-step-preview" }, ProcessUtil.preview(text))),
|
|
312
|
+
open && text && React.createElement("div", { className: "ta-thinking-text" }, text)));
|
|
313
|
+
});
|
|
314
|
+
/**
|
|
315
|
+
* What the user said while the agent worked (steering), where in its work it read it: a small bubble on the string of
|
|
316
|
+
* the steps, marked as said on the way, with where it came from when not typed. It stays in sight when the steps fold.
|
|
317
|
+
*/
|
|
318
|
+
const SaidStep = React.memo(function SaidStep({ message }) {
|
|
319
|
+
const t = useT();
|
|
320
|
+
const blocks = MessageUtil.blocks(message);
|
|
321
|
+
const { text } = userWords(blocks);
|
|
322
|
+
return (React.createElement("div", { className: "ta-step-said" },
|
|
323
|
+
React.createElement("span", { className: "ta-status ta-status-said" }),
|
|
324
|
+
React.createElement("div", { className: "ta-said-head", title: t('ta.message.steeredTitle') },
|
|
325
|
+
React.createElement(Icon, { icon: CornerDownRight, size: 12 }),
|
|
326
|
+
React.createElement("span", null, t('ta.message.steered')),
|
|
327
|
+
React.createElement(MessageOrigin, { blocks: blocks })),
|
|
328
|
+
React.createElement(UserSaid, { blocks: blocks, text: text, bubble: "ta-said-bubble", timestamp: message.timestamp })));
|
|
329
|
+
});
|
|
330
|
+
const TextStep = React.memo(function TextStep({ text, streaming }) {
|
|
258
331
|
return (React.createElement("div", { className: "ta-step-text" },
|
|
259
332
|
React.createElement("span", { className: "ta-status ta-status-thought" }),
|
|
260
|
-
React.createElement(Markdown, { text: text })));
|
|
333
|
+
React.createElement(Markdown, { text: text, streaming: streaming })));
|
|
261
334
|
});
|
|
262
|
-
function Step({ step, results, tools, tagged }) {
|
|
335
|
+
function Step({ step, results, tools, tagged, streaming, }) {
|
|
263
336
|
var _a;
|
|
264
337
|
switch (step.kind) {
|
|
265
338
|
case 'thinking':
|
|
266
339
|
return React.createElement(ThinkingStep, { text: step.text, tagged: tagged });
|
|
267
340
|
case 'text':
|
|
268
|
-
return React.createElement(TextStep, { text: step.text });
|
|
341
|
+
return React.createElement(TextStep, { text: step.text, streaming: streaming });
|
|
269
342
|
case 'summary':
|
|
270
343
|
return React.createElement(SummaryStep, { text: step.text });
|
|
344
|
+
case 'error':
|
|
345
|
+
return React.createElement(ErrorStep, { text: step.text });
|
|
346
|
+
case 'said':
|
|
347
|
+
return React.createElement(SaidStep, { message: step.message });
|
|
271
348
|
default: {
|
|
272
349
|
const { id = '', name = '', arguments: args } = step.call;
|
|
273
350
|
return (React.createElement(ToolView, { id: id, name: name, args: (_a = args) !== null && _a !== void 0 ? _a : {}, run: id ? tools[id] : undefined, message: id ? results.get(id) : undefined, runs: tools }));
|
|
@@ -333,17 +410,24 @@ function useFold(open, ref, slideOpen) {
|
|
|
333
410
|
* so that a long conversation reads as what was asked and what came of it. Before the first step the
|
|
334
411
|
* line says what ta does. The avatar stays the same element from the turn's first frame to its last.
|
|
335
412
|
*/
|
|
336
|
-
export function Process({ steps, active, results, tools, leading, status, }) {
|
|
413
|
+
export function Process({ steps, active, results, tools, leading, status, stopped, }) {
|
|
337
414
|
const t = useT();
|
|
338
415
|
const [manual, setManual] = React.useState();
|
|
339
416
|
const [showAll, setShowAll] = React.useState(false);
|
|
340
417
|
const id = React.useId();
|
|
341
418
|
const stepsRef = React.useRef(null);
|
|
342
419
|
const { steps: count, failed } = ToolUtil.count(ProcessUtil.tools(steps), results, tools);
|
|
343
|
-
// Open while it works, then folded; a failed step says so on the head, quietly.
|
|
344
|
-
|
|
420
|
+
// Open while it works, then folded; a failed step says so on the head, quietly. A turn that stopped short keeps
|
|
421
|
+
// its work open: there is no reply, and its last steps say where it stopped.
|
|
422
|
+
const open = manual !== null && manual !== void 0 ? manual : (active || !!stopped);
|
|
345
423
|
const shown = useFold(open && steps.length > 0, stepsRef, !active);
|
|
346
|
-
const folded = ProcessUtil.fold(steps, active, showAll);
|
|
424
|
+
const folded = ProcessUtil.fold(steps, active || !!stopped, showAll);
|
|
425
|
+
// Folded, the cards on the way stay under the head: a choice asked in the middle is not hidden with the work.
|
|
426
|
+
const renderers = React.useContext(CodeRenderers);
|
|
427
|
+
const pinned = open ? [] : steps.filter(step => ProcessUtil.pinned(step, renderers));
|
|
428
|
+
const inline = pinned.length ? folded.steps.filter(step => !ProcessUtil.pinned(step, renderers)) : folded.steps;
|
|
429
|
+
// Folded, what the user said on the way stays too: their words do not go into the work.
|
|
430
|
+
const said = open ? [] : steps.filter(step => step.kind === 'said');
|
|
347
431
|
// The earlier steps count as the head does: the calls among them, not the thoughts.
|
|
348
432
|
const earlier = folded.hidden ? ToolUtil.count(ProcessUtil.tools(steps.slice(0, folded.hidden)), results, tools).steps : 0;
|
|
349
433
|
// Only thoughts: the head already says so, the steps need not say it again.
|
|
@@ -360,7 +444,9 @@ export function Process({ steps, active, results, tools, leading, status, }) {
|
|
|
360
444
|
React.createElement(Icon, { icon: ChevronRight, size: 14, className: "ta-process-chevron" }))) : (status)),
|
|
361
445
|
shown && (React.createElement("div", { id: id, ref: stepsRef, className: "ta-process-steps" },
|
|
362
446
|
folded.hidden > 0 && (React.createElement("button", { type: "button", className: "ta-link ta-more", onClick: () => setShowAll(true) }, earlier ? t('ta.process.earlier', { count: earlier }) : t('ta.process.showAll'))),
|
|
363
|
-
|
|
447
|
+
inline.map((step, index) => (React.createElement(Step, { key: step.key, step: step, results: results, tools: tools, tagged: !thoughtOnly, streaming: active && index === inline.length - 1 }))))),
|
|
448
|
+
said.length > 0 && (React.createElement("div", { className: "ta-process-steps ta-said-folded" }, said.map(step => (React.createElement(SaidStep, { key: step.key, message: step.message }))))),
|
|
449
|
+
pinned.map(step => (React.createElement(Markdown, { key: step.key, text: step.text })))));
|
|
364
450
|
}
|
|
365
451
|
/** A turn that has shown nothing yet: what ta does goes on its head. */
|
|
366
452
|
export function quiet(item) {
|
|
@@ -375,13 +461,22 @@ export function endsInSteps(item) {
|
|
|
375
461
|
return (item === null || item === void 0 ? void 0 : item.kind) === 'turn' && item.steps.length > 0 && !item.reply.length;
|
|
376
462
|
}
|
|
377
463
|
function Turn({ item, tools, mood, status, latest, }) {
|
|
464
|
+
const compacted = ProcessUtil.compaction(item);
|
|
465
|
+
if (compacted !== undefined) {
|
|
466
|
+
return React.createElement(CompactionBreak, { summary: compacted, tokens: MessageUtil.usage(item.messages).input });
|
|
467
|
+
}
|
|
468
|
+
return React.createElement(WorkTurn, { item: item, tools: tools, mood: mood, status: status, latest: latest });
|
|
469
|
+
}
|
|
470
|
+
function WorkTurn({ item, tools, mood, status, latest, }) {
|
|
378
471
|
var _a;
|
|
379
472
|
const t = useT();
|
|
380
473
|
const session = React.useContext(ConversationSession);
|
|
381
474
|
const results = MessageUtil.results(item.messages);
|
|
382
475
|
const { errorMessage } = ((_a = item.last) !== null && _a !== void 0 ? _a : {});
|
|
383
|
-
const
|
|
476
|
+
const ending = ProcessUtil.ending(item);
|
|
477
|
+
const held = useHeld(item.active, ending === 'silent' || ending === 'interrupted');
|
|
384
478
|
const reply = item.reply.join('\n\n').trim();
|
|
479
|
+
const actions = React.useContext(MessageActions);
|
|
385
480
|
const [menu, onContextMenu] = useMessageMenu({
|
|
386
481
|
kind: 'turn',
|
|
387
482
|
last: item.active ? undefined : item.last,
|
|
@@ -390,13 +485,48 @@ function Turn({ item, tools, mood, status, latest, }) {
|
|
|
390
485
|
messages: item.messages,
|
|
391
486
|
});
|
|
392
487
|
return (React.createElement("div", { className: `ta-message ta-assistant ${item.active ? 'ta-turn-live' : ''}`, onContextMenu: onContextMenu },
|
|
393
|
-
React.createElement(Process, { steps: item.steps, active: item.active, results: results, tools: tools, leading: React.createElement(TurnAvatar, { mood: mood }), status: status }),
|
|
488
|
+
React.createElement(Process, { steps: item.steps, active: item.active, stopped: ending !== undefined && ending !== 'aborted', results: results, tools: tools, leading: React.createElement(TurnAvatar, { mood: mood }), status: status }),
|
|
394
489
|
item.reply.map((text, index) => (React.createElement(Markdown, { key: index, text: text, streaming: item.active && index === item.reply.length - 1 }))),
|
|
395
|
-
|
|
396
|
-
|
|
490
|
+
ending && ending !== 'aborted' && !held && (React.createElement(TurnEnd, { ending: ending, error: errorMessage, resume: latest && !(actions === null || actions === void 0 ? void 0 : actions.working) ? actions === null || actions === void 0 ? void 0 : actions.resume : undefined })),
|
|
491
|
+
ending === 'aborted' && React.createElement("div", { className: "ta-muted ta-small" }, t('ta.message.stopped')),
|
|
397
492
|
!item.active && React.createElement(TurnFooter, { messages: item.messages, last: item.last, reply: reply, session: session, latest: latest }),
|
|
398
493
|
menu));
|
|
399
494
|
}
|
|
495
|
+
/** How long a turn that just ended without a reply waits before it says so: an agent that goes on by itself does within it. */
|
|
496
|
+
const HOLD_MS = 8000;
|
|
497
|
+
/**
|
|
498
|
+
* Whether a turn seen to end without a reply (`quiet`) holds back what it says of it for a while: an external agent
|
|
499
|
+
* often ends a turn empty and goes on by itself seconds later, which made the warning come and go. A turn read
|
|
500
|
+
* already ended says it at once.
|
|
501
|
+
*/
|
|
502
|
+
function useHeld(active, quiet) {
|
|
503
|
+
const [was, setWas] = React.useState(active);
|
|
504
|
+
const [held, setHeld] = React.useState(false);
|
|
505
|
+
if (was !== active) {
|
|
506
|
+
// Set while drawing, before what it draws is shown: the warning does not show for a frame first.
|
|
507
|
+
setWas(active);
|
|
508
|
+
setHeld(!active && quiet);
|
|
509
|
+
}
|
|
510
|
+
React.useEffect(() => {
|
|
511
|
+
if (held) {
|
|
512
|
+
const timer = setTimeout(() => setHeld(false), HOLD_MS);
|
|
513
|
+
return () => clearTimeout(timer);
|
|
514
|
+
}
|
|
515
|
+
}, [held]);
|
|
516
|
+
return held;
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Why a turn stopped short, under it: the error, or that it was cut off, or ended without a word; the last turn has
|
|
520
|
+
* a button to go on, which says so to the agent.
|
|
521
|
+
*/
|
|
522
|
+
function TurnEnd({ ending, error, resume }) {
|
|
523
|
+
const t = useT();
|
|
524
|
+
const action = resume && (React.createElement("button", { type: "button", className: "ta-button", onClick: resume }, t('ta.message.resume')));
|
|
525
|
+
if (ending === 'error') {
|
|
526
|
+
return (React.createElement(Callout, { level: "error", action: action }, (error === null || error === void 0 ? void 0 : error.trim()) || t('ta.message.failedUnknown')));
|
|
527
|
+
}
|
|
528
|
+
return (React.createElement(Callout, { level: "warning", action: action }, t(ending === 'interrupted' ? 'ta.message.interrupted' : 'ta.message.silent')));
|
|
529
|
+
}
|
|
400
530
|
/** `!command` of a user, which pi records as its own kind of message. */
|
|
401
531
|
function BashMessage({ message }) {
|
|
402
532
|
const { command, output, exitCode } = message;
|
|
@@ -409,6 +539,25 @@ function BashMessage({ message }) {
|
|
|
409
539
|
output && (React.createElement("div", { className: "ta-tool-body" },
|
|
410
540
|
React.createElement("pre", { className: "ta-output" }, output))))));
|
|
411
541
|
}
|
|
542
|
+
/**
|
|
543
|
+
* Where the context was compacted, by pi (`compactionSummary`) or by an external agent (ProcessUtil.compaction):
|
|
544
|
+
* a quiet mark across the conversation, as where it switched models, with how much was compacted; it opens to
|
|
545
|
+
* the summary the agent goes on from.
|
|
546
|
+
*/
|
|
547
|
+
function CompactionBreak({ summary, tokens }) {
|
|
548
|
+
const t = useT();
|
|
549
|
+
const [open, setOpen] = React.useState(false);
|
|
550
|
+
return (React.createElement("div", { className: "ta-compaction" },
|
|
551
|
+
React.createElement("button", { type: "button", className: "ta-compaction-mark", "aria-expanded": open, onClick: () => setOpen(!open) },
|
|
552
|
+
React.createElement(Icon, { icon: FoldVertical, size: 12 }),
|
|
553
|
+
React.createElement("span", null, t('ta.message.compacted')),
|
|
554
|
+
!!tokens && React.createElement("span", { className: "ta-compaction-tokens" },
|
|
555
|
+
"\u00B7 ",
|
|
556
|
+
t('ta.message.compactedFrom', { tokens: ProgressUtil.format(tokens) })),
|
|
557
|
+
React.createElement(Icon, { icon: ChevronRight, size: 12, className: "ta-compaction-chevron" })),
|
|
558
|
+
open && summary.trim() && (React.createElement("div", { className: "ta-compaction-summary" },
|
|
559
|
+
React.createElement(Markdown, { text: summary })))));
|
|
560
|
+
}
|
|
412
561
|
function SummaryMessage({ title, text }) {
|
|
413
562
|
const t = useT();
|
|
414
563
|
return (React.createElement("details", { className: "ta-summary" },
|
|
@@ -420,13 +569,13 @@ function Message({ item }) {
|
|
|
420
569
|
const { message } = item;
|
|
421
570
|
switch (message.role) {
|
|
422
571
|
case 'user':
|
|
423
|
-
return React.createElement(UserMessage, { message: message });
|
|
572
|
+
return React.createElement(UserMessage, { message: message, queued: item.queued });
|
|
424
573
|
case 'bashExecution':
|
|
425
574
|
return React.createElement(BashMessage, { message: message });
|
|
426
575
|
case 'custom':
|
|
427
576
|
return React.createElement(CustomMessage, { message: message });
|
|
428
577
|
case 'compactionSummary':
|
|
429
|
-
return React.createElement(
|
|
578
|
+
return React.createElement(CompactionBreak, { summary: (_a = message.summary) !== null && _a !== void 0 ? _a : '', tokens: message.tokensBefore });
|
|
430
579
|
case 'branchSummary':
|
|
431
580
|
return React.createElement(SummaryMessage, { title: "ta.message.branch", text: (_b = message.summary) !== null && _b !== void 0 ? _b : '' });
|
|
432
581
|
default:
|
|
@@ -444,36 +593,49 @@ const ThreadRow = React.memo(function ThreadRow({ item, tools, mood, status, lat
|
|
|
444
593
|
previous.latest === next.latest &&
|
|
445
594
|
ProcessUtil.same(previous.item, next.item) &&
|
|
446
595
|
(next.item.kind === 'message' || !next.item.active || previous.tools === next.tools));
|
|
596
|
+
/** `key`, once a frame was painted with it: until then, the one before. */
|
|
597
|
+
function useLaidOut(key) {
|
|
598
|
+
const [painted, setPainted] = React.useState(key);
|
|
599
|
+
React.useEffect(() => {
|
|
600
|
+
if (key === painted) {
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
// The first frame lays it out, the next comes after it was painted.
|
|
604
|
+
let frame = requestAnimationFrame(() => {
|
|
605
|
+
frame = requestAnimationFrame(() => setPainted(key));
|
|
606
|
+
});
|
|
607
|
+
return () => cancelAnimationFrame(frame);
|
|
608
|
+
}, [key, painted]);
|
|
609
|
+
return painted;
|
|
610
|
+
}
|
|
447
611
|
/** The last rows, which change and are in view, are always laid out. */
|
|
448
612
|
const SETTLED_AFTER = 4;
|
|
449
613
|
/** The conversation; tool results show with the calls they answer. `rows`: only its latest rows are drawn, more as asked. */
|
|
450
614
|
export function MessageList({ state, outbox, rows }) {
|
|
451
615
|
var _a;
|
|
616
|
+
var _b;
|
|
452
617
|
const renderers = React.useContext(MessageRenderers);
|
|
453
618
|
const items = React.useMemo(() => ProcessUtil.items(state.messages, state.working, state.start, renderers), [state.messages, state.working, state.start, renderers]);
|
|
454
619
|
const breaks = React.useMemo(() => ProcessUtil.timeBreaks(ProcessUtil.starts(items), index => ProcessUtil.shown(items[index], renderers)), [items, renderers]);
|
|
455
620
|
const models = React.useMemo(() => ProcessUtil.modelBreaks(items), [items]);
|
|
621
|
+
// A turn's cards know what the user said after it: a choice they asked for is made.
|
|
622
|
+
const answers = React.useMemo(() => ProcessUtil.answers(items, message => userWords(MessageUtil.blocks(message)).copied), [items]);
|
|
456
623
|
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]);
|
|
457
624
|
// The rows held back: those before the latest `rows.rows`.
|
|
458
625
|
const from = rows ? Math.max(0, items.length - rows.rows) : 0;
|
|
459
626
|
if (rows) {
|
|
460
627
|
rows.hidden.current = from;
|
|
461
628
|
}
|
|
462
|
-
// Rows of earlier messages put in front are laid out
|
|
463
|
-
//
|
|
464
|
-
|
|
465
|
-
const
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
const
|
|
472
|
-
const count = React.useRef(items.length);
|
|
473
|
-
if (items.length < still.current || items.length > count.current + 2) {
|
|
474
|
-
still.current = items.length;
|
|
475
|
-
}
|
|
476
|
-
count.current = items.length;
|
|
629
|
+
// Rows of earlier messages put in front are laid out in a frame before they may skip it (content-visibility):
|
|
630
|
+
// the browser keeps the height it laid out only as it paints, and a row that skips before has a height made
|
|
631
|
+
// up, which turns into its own as it comes into view, under the user's finger.
|
|
632
|
+
const laidOut = useLaidOut((_a = items[from]) === null || _a === void 0 ? void 0 : _a.key);
|
|
633
|
+
const front = Math.max(from, items.findIndex(item => item.key === laidOut));
|
|
634
|
+
// Rows that come after the list is drawn come in with a motion; those of a conversation opened or loaded again,
|
|
635
|
+
// and those already there when earlier messages come in front of them, still: by key, not by index.
|
|
636
|
+
const freshRows = React.useRef(undefined);
|
|
637
|
+
(_b = freshRows.current) !== null && _b !== void 0 ? _b : (freshRows.current = new FreshRows(items));
|
|
638
|
+
const fresh = freshRows.current.from(items);
|
|
477
639
|
let lastTurn = items.length - 1;
|
|
478
640
|
while (lastTurn >= 0 && items[lastTurn].kind !== 'turn') {
|
|
479
641
|
lastTurn--;
|
|
@@ -488,14 +650,15 @@ export function MessageList({ state, outbox, rows }) {
|
|
|
488
650
|
'ta-thread-item',
|
|
489
651
|
index >= front && index < items.length - SETTLED_AFTER && 'ta-settled',
|
|
490
652
|
index === items.length - 1 && 'ta-thread-last',
|
|
491
|
-
index >=
|
|
653
|
+
index >= fresh && 'ta-thread-new',
|
|
492
654
|
item.kind === 'message' && item.message.role === 'user' && ASK_CLASS,
|
|
493
655
|
]
|
|
494
656
|
.filter(Boolean)
|
|
495
657
|
.join(' ') },
|
|
496
658
|
breaks[index] !== undefined && React.createElement(TimeBreak, { timestamp: breaks[index] }),
|
|
497
659
|
models[index] && React.createElement(ModelBreak, { model: models[index] }),
|
|
498
|
-
React.createElement(
|
|
660
|
+
React.createElement(CodeAnswer.Provider, { value: answers[index] },
|
|
661
|
+
React.createElement(ThreadRow, { item: item, tools: state.tools, mood: item.kind === 'turn' ? ProcessUtil.mood(item, index === lastTurn, waiting) : 'idle', status: onHead && item === last ? status : undefined, latest: index === lastTurn }))))),
|
|
499
662
|
status && !onHead && React.createElement("div", { className: `ta-run-line ${endsInSteps(last) ? 'ta-run-steps' : ''}` }, status)));
|
|
500
663
|
}
|
|
501
664
|
//# sourceMappingURL=message-list.js.map
|
|
@@ -17,6 +17,8 @@ export interface PhoneTab {
|
|
|
17
17
|
unseen?: boolean;
|
|
18
18
|
/** Sees all of it, as the user drags its dot away (UnseenDrop); the dot stays put without. */
|
|
19
19
|
onSeeAll?(): void;
|
|
20
|
+
/** How many of it wait for the user to decide: a blue count, in place of the amber dot. */
|
|
21
|
+
asks?: number;
|
|
20
22
|
}
|
|
21
23
|
export interface PhoneShellProps {
|
|
22
24
|
tabs: PhoneTab[];
|
|
@@ -83,8 +85,11 @@ export declare function PhoneStack({ base, top, open, onClose }: PhoneStackProps
|
|
|
83
85
|
export declare namespace PhoneUtil {
|
|
84
86
|
/** Two taps of a tab within this are one double tap. */
|
|
85
87
|
const DOUBLE_TAP_MS = 350;
|
|
86
|
-
/**
|
|
87
|
-
|
|
88
|
+
/**
|
|
89
|
+
* What marks a row with a dot of something unseen, in any list of the tabs (an extension's too), or with the ? of
|
|
90
|
+
* a conversation that waits for the user to decide, at the top of the chats: those are found first.
|
|
91
|
+
*/
|
|
92
|
+
const UNSEEN = "[data-unseen], [data-asks]";
|
|
88
93
|
/**
|
|
89
94
|
* Scrolls the list of the tab to its next row with a dot, below the top of what shows, else from the first
|
|
90
95
|
* again: each tap one further, as WeChat's. Those all on the screen already are not scrolled to, only lit up.
|
|
@@ -6,6 +6,7 @@ import { useHeld } from '../device/hold.js';
|
|
|
6
6
|
import { usePullDown } from '../device/pull-down.js';
|
|
7
7
|
import { useSheetSwipe } from '../device/sheet-swipe.js';
|
|
8
8
|
import { useT } from '../i18n/use-t.js';
|
|
9
|
+
import { AsksBadge } from './asks-badge.js';
|
|
9
10
|
import { useContextMenu } from './context-menu.js';
|
|
10
11
|
import { DinoFace } from './ta-avatar.js';
|
|
11
12
|
import { UnseenDrop } from './unseen-drop.js';
|
|
@@ -138,6 +139,8 @@ export function PhoneShell(props) {
|
|
|
138
139
|
sheet: '.ta-phone > .ta-editors-pane',
|
|
139
140
|
under: screenOpen ? '.ta-phone-screen' : '.ta-phone-home',
|
|
140
141
|
scrim: '.ta-phone-dim[data-for="workbench"]',
|
|
142
|
+
// A row swipes to the left as the workbench comes: over one, the workbench comes only from the edge.
|
|
143
|
+
edgeOver: '.ta-swipe-row[data-swipeable]',
|
|
141
144
|
});
|
|
142
145
|
// The layers in the order they stack, the top first: the workbench, what is pushed over the screen or the launcher, then
|
|
143
146
|
// the screen or what came out over the first tab. Going back closes those past the depth the history is at.
|
|
@@ -226,7 +229,7 @@ function TabBar({ tabs, tab, onTab }) {
|
|
|
226
229
|
return (React.createElement("button", { key: item.id, type: "button", className: `ta-tabbar-item${active ? ' ta-active' : ''}`, "aria-current": active ? 'page' : undefined, onClick: event => (active ? again(item.id, event.currentTarget.closest('.ta-phone-home')) : onTab(item.id)), onContextMenu: item.menu ? event => { var _a; return openMenu(event, (_a = item.menu) !== null && _a !== void 0 ? _a : []); } : undefined, ...held(item.hold) },
|
|
227
230
|
React.createElement("span", { className: "ta-tabbar-icon" },
|
|
228
231
|
item.double ? React.createElement(DinoFace, { size: 24, className: "ta-nav-face" }) : React.createElement(Glyph, { size: 22, strokeWidth: active ? 2 : 1.6 }),
|
|
229
|
-
item.unseen && React.createElement(UnseenDrop, { label: t('ta.chat.unseen'), onDismiss: item.onSeeAll })),
|
|
232
|
+
item.asks ? React.createElement(AsksBadge, { count: item.asks }) : item.unseen && React.createElement(UnseenDrop, { label: t('ta.chat.unseen'), onDismiss: item.onSeeAll })),
|
|
230
233
|
React.createElement("span", null, item.label)));
|
|
231
234
|
}),
|
|
232
235
|
menu));
|
|
@@ -235,8 +238,11 @@ export var PhoneUtil;
|
|
|
235
238
|
(function (PhoneUtil) {
|
|
236
239
|
/** Two taps of a tab within this are one double tap. */
|
|
237
240
|
PhoneUtil.DOUBLE_TAP_MS = 350;
|
|
238
|
-
/**
|
|
239
|
-
|
|
241
|
+
/**
|
|
242
|
+
* What marks a row with a dot of something unseen, in any list of the tabs (an extension's too), or with the ? of
|
|
243
|
+
* a conversation that waits for the user to decide, at the top of the chats: those are found first.
|
|
244
|
+
*/
|
|
245
|
+
PhoneUtil.UNSEEN = '[data-unseen], [data-asks]';
|
|
240
246
|
/** Over the row scrolled to, the room left above it. */
|
|
241
247
|
const GAP = 8;
|
|
242
248
|
const FLASH_MS = 1000;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type TaRelayFeature, type TaRelayProbe, type TaRelayService, type TaRelayTypeInfo } from '@celljs/ta-protocol';
|
|
2
|
+
import { type LucideIcon } from 'lucide-react';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useT } from '../i18n/use-t.js';
|
|
5
|
+
export declare namespace RelayServicesUtil {
|
|
6
|
+
/** What a service is called: the official relay, its name, else its host or its folder. */
|
|
7
|
+
function label(service: TaRelayService, t: ReturnType<typeof useT>): string;
|
|
8
|
+
/** Where a service is: a relay's host, a folder's path, where a store of a package is (a host, a bucket). */
|
|
9
|
+
function where(service: TaRelayService): string;
|
|
10
|
+
/** Whether a service can carry a feature: all can but a folder and a store, which only sync uses. */
|
|
11
|
+
function serves(service: TaRelayService, feature: TaRelayFeature): boolean;
|
|
12
|
+
/** The icon of a service: the official relay, a relay, a folder, a store by the icon its package gave its type. */
|
|
13
|
+
function icon(service: TaRelayService, types?: readonly TaRelayTypeInfo[]): LucideIcon;
|
|
14
|
+
function iconNamed(name: string | undefined): LucideIcon;
|
|
15
|
+
/** What a relay shows under its name: where it is, whether it answers, what it keeps. */
|
|
16
|
+
function line(service: TaRelayService, probe: TaRelayProbe | undefined, t: ReturnType<typeof useT>): string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The relays of relays.json (docs/design/ta-relays.md) and which one each feature uses: phones that reach this
|
|
20
|
+
* computer, links that share, rooms and playing together, sync of the user's computers. A relay is the official one,
|
|
21
|
+
* one on the user's own Cloudflare or `ta relay` behind HTTPS; it reads none of what goes through it. What a feature
|
|
22
|
+
* made before (a device, a room, a link) stays on its relay when the choice changes.
|
|
23
|
+
*/
|
|
24
|
+
export declare function RelayServices(): React.JSX.Element | null;
|