@celljs/ta-web 4.12.0 → 4.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/assistant/assistant-extension.js +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 +5 -4
- package/esm/browser/assistant/assistant.d.ts +5 -0
- package/esm/browser/assistant/assistant.js +25 -6
- 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 +18 -9
- 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.d.ts +7 -1
- package/esm/browser/components/composer.js +33 -20
- package/esm/browser/components/connection-bar.js +31 -12
- package/esm/browser/components/conversation-scroll-util.d.ts +5 -0
- package/esm/browser/components/conversation-scroll-util.js +18 -0
- package/esm/browser/components/conversation-scroll.d.ts +12 -2
- package/esm/browser/components/conversation-scroll.js +68 -5
- 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/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 +4 -39
- package/esm/browser/components/mermaid-view.js +45 -3
- package/esm/browser/components/message-footer.d.ts +2 -0
- package/esm/browser/components/message-footer.js +8 -1
- package/esm/browser/components/message-list.d.ts +12 -0
- package/esm/browser/components/message-list.js +156 -25
- package/esm/browser/components/phone-shell.d.ts +7 -2
- package/esm/browser/components/phone-shell.js +7 -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.js +16 -4
- package/esm/browser/components/settings-controls.js +3 -3
- package/esm/browser/components/settings-parts.js +13 -1
- 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/web-composer.js +2 -1
- 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 +9 -1
- package/esm/browser/extension/web-api-components.d.ts +3 -3
- package/esm/browser/extension/web-api-contributions.d.ts +119 -0
- package/esm/browser/extension/web-extension-api.d.ts +23 -46
- package/esm/browser/extension/web-extension-context.d.ts +6 -1
- package/esm/browser/extension/web-extension-context.js +63 -6
- package/esm/browser/extension/web-extension-protocol.d.ts +5 -1
- package/esm/browser/extension/web-extension-protocol.js +1 -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 +9 -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 +69 -3
- package/esm/browser/i18n/messages.d.ts +68 -2
- package/esm/browser/i18n/messages.js +138 -6
- 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 +51 -0
- package/esm/browser/style/device.js +3 -0
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +24 -9
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +2 -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 +14 -3
- package/esm/browser/util/desktop.d.ts +18 -1
- package/esm/browser/util/desktop.js +13 -0
- package/esm/browser/util/process.d.ts +26 -1
- package/esm/browser/util/process.js +79 -5
- 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 +3 -2
- package/lib/browser/assistant/assistant.d.ts +5 -0
- package/lib/browser/assistant/assistant.js +24 -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 +17 -8
- 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.d.ts +7 -1
- package/lib/browser/components/composer.js +33 -19
- package/lib/browser/components/connection-bar.js +30 -11
- package/lib/browser/components/conversation-scroll-util.d.ts +5 -0
- package/lib/browser/components/conversation-scroll-util.js +18 -0
- package/lib/browser/components/conversation-scroll.d.ts +12 -2
- package/lib/browser/components/conversation-scroll.js +68 -5
- 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/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 +3 -38
- package/lib/browser/components/mermaid-view.js +45 -3
- package/lib/browser/components/message-footer.d.ts +2 -0
- package/lib/browser/components/message-footer.js +8 -0
- package/lib/browser/components/message-list.d.ts +12 -0
- package/lib/browser/components/message-list.js +153 -20
- package/lib/browser/components/phone-shell.d.ts +7 -2
- package/lib/browser/components/phone-shell.js +7 -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.js +15 -3
- package/lib/browser/components/settings-controls.js +3 -3
- package/lib/browser/components/settings-parts.js +13 -1
- 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/web-composer.js +2 -1
- 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 +8 -0
- package/lib/browser/extension/web-api-components.d.ts +3 -3
- package/lib/browser/extension/web-api-contributions.d.ts +119 -0
- package/lib/browser/extension/web-extension-api.d.ts +23 -46
- package/lib/browser/extension/web-extension-context.d.ts +6 -1
- package/lib/browser/extension/web-extension-context.js +63 -6
- package/lib/browser/extension/web-extension-protocol.d.ts +5 -1
- package/lib/browser/extension/web-extension-protocol.js +1 -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 +9 -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 +69 -3
- package/lib/browser/i18n/messages.d.ts +68 -2
- package/lib/browser/i18n/messages.js +138 -6
- 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 +51 -0
- package/lib/browser/style/device.js +3 -0
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +24 -9
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +2 -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 +14 -3
- package/lib/browser/util/desktop.d.ts +18 -1
- package/lib/browser/util/desktop.js +13 -0
- package/lib/browser/util/process.d.ts +26 -1
- package/lib/browser/util/process.js +79 -5
- 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
|
@@ -6,6 +6,36 @@ import { MermaidRenderer, MermaidUtil } from '../markdown/mermaid.js';
|
|
|
6
6
|
import { IconButton } from './icon.js';
|
|
7
7
|
/** While a reply streams its source, the diagram waits for it to rest a moment. */
|
|
8
8
|
const DRAW_DELAY_MS = 150;
|
|
9
|
+
/** A diagram draws once it is this near the view: one far up of a conversation scrolled through does not. */
|
|
10
|
+
const NEAR_VIEW = '100% 0px';
|
|
11
|
+
/** What scrolls `element`, the page when nothing else does. */
|
|
12
|
+
function scrollerOf(element) {
|
|
13
|
+
for (let node = element.parentElement; node; node = node.parentElement) {
|
|
14
|
+
const overflow = getComputedStyle(node).overflowY;
|
|
15
|
+
if (overflow === 'auto' || overflow === 'scroll') {
|
|
16
|
+
return node;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
/** Whether `ref` is near the view (NEAR_VIEW), once it was; at once where it cannot be told. */
|
|
22
|
+
function useNear(ref, watch) {
|
|
23
|
+
const [near, setNear] = React.useState(typeof IntersectionObserver === 'undefined');
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
const element = ref.current;
|
|
26
|
+
if (near || !watch || !element) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
// The margin is of the root: of what scrolls it (a conversation), not of the page, which clips it to its view.
|
|
30
|
+
const observer = new IntersectionObserver(entries => entries.some(entry => entry.isIntersecting) && setNear(true), {
|
|
31
|
+
root: scrollerOf(element),
|
|
32
|
+
rootMargin: NEAR_VIEW,
|
|
33
|
+
});
|
|
34
|
+
observer.observe(element);
|
|
35
|
+
return () => observer.disconnect();
|
|
36
|
+
}, [ref, near, watch]);
|
|
37
|
+
return near;
|
|
38
|
+
}
|
|
9
39
|
function download(svg) {
|
|
10
40
|
const background = getComputedStyle(document.documentElement).getPropertyValue('--ta-code').trim();
|
|
11
41
|
const url = URL.createObjectURL(new Blob([MermaidUtil.withBackground(svg, background)], { type: 'image/svg+xml' }));
|
|
@@ -31,6 +61,9 @@ export function MermaidView({ code, fallback }) {
|
|
|
31
61
|
const [copied, setCopied] = React.useState(false);
|
|
32
62
|
const [fullscreen, setFullscreen] = React.useState(false);
|
|
33
63
|
const frame = React.useRef(null);
|
|
64
|
+
const waiting = React.useRef(null);
|
|
65
|
+
const shown = !!drawn && code.startsWith(drawn.code);
|
|
66
|
+
const near = useNear(waiting, !shown);
|
|
34
67
|
React.useEffect(() => {
|
|
35
68
|
let current = true;
|
|
36
69
|
const cached = MermaidRenderer.cached(theme, code);
|
|
@@ -38,6 +71,9 @@ export function MermaidView({ code, fallback }) {
|
|
|
38
71
|
setDrawn({ code, svg: cached });
|
|
39
72
|
return;
|
|
40
73
|
}
|
|
74
|
+
if (!near) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
41
77
|
const timer = setTimeout(() => {
|
|
42
78
|
MermaidRenderer.render(theme, code).then(svg => current && svg && setDrawn({ code, svg }));
|
|
43
79
|
}, DRAW_DELAY_MS);
|
|
@@ -45,14 +81,20 @@ export function MermaidView({ code, fallback }) {
|
|
|
45
81
|
current = false;
|
|
46
82
|
clearTimeout(timer);
|
|
47
83
|
};
|
|
48
|
-
}, [theme, code]);
|
|
84
|
+
}, [theme, code, near]);
|
|
49
85
|
React.useEffect(() => {
|
|
50
86
|
const changed = () => setFullscreen(document.fullscreenElement === frame.current);
|
|
51
87
|
document.addEventListener('fullscreenchange', changed);
|
|
52
88
|
return () => document.removeEventListener('fullscreenchange', changed);
|
|
53
89
|
}, []);
|
|
54
|
-
if (!drawn || !
|
|
55
|
-
|
|
90
|
+
if (!drawn || !shown) {
|
|
91
|
+
// Shown before on this device: its place, as large as it drew, so that nothing moves as it draws again.
|
|
92
|
+
const size = MermaidRenderer.size(code);
|
|
93
|
+
return size ? (React.createElement("div", { ref: waiting, className: "ta-code ta-mermaid" },
|
|
94
|
+
React.createElement("div", { className: "ta-code-bar" },
|
|
95
|
+
React.createElement("span", null, "mermaid")),
|
|
96
|
+
React.createElement("div", { className: "ta-mermaid-diagram" },
|
|
97
|
+
React.createElement("div", { className: "ta-mermaid-room", style: { maxWidth: size.width, aspectRatio: `${size.width} / ${size.height}` } })))) : (React.createElement("div", { ref: waiting }, fallback));
|
|
56
98
|
}
|
|
57
99
|
const copy = () => {
|
|
58
100
|
var _a;
|
|
@@ -34,6 +34,8 @@ export declare function TimeBreak({ timestamp }: {
|
|
|
34
34
|
export declare function ModelBreak({ model }: {
|
|
35
35
|
model: string;
|
|
36
36
|
}): React.JSX.Element;
|
|
37
|
+
/** Where a restart of ta serve cut the run off and it went on (TA_RESUME_MESSAGE): a mark as where it switched models. */
|
|
38
|
+
export declare function ResumeBreak(): React.JSX.Element;
|
|
37
39
|
/** Under a message of the user: when, copy, a new conversation from here, back to here. */
|
|
38
40
|
export declare function UserFooter({ message, text }: {
|
|
39
41
|
message: SessionMessage;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrowDown, ArrowRightLeft, ArrowUp, Bug, Check, Copy, GitFork, TextQuote, Undo2 } from 'lucide-react';
|
|
1
|
+
import { ArrowDown, ArrowRightLeft, ArrowUp, Bug, Check, Copy, GitFork, RotateCw, TextQuote, Undo2 } from 'lucide-react';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useT } from '../i18n/use-t.js';
|
|
4
4
|
import { MessageUtil } from '../util/message.js';
|
|
@@ -72,6 +72,13 @@ export function ModelBreak({ model }) {
|
|
|
72
72
|
React.createElement(Icon, { icon: ArrowRightLeft, size: 12 }),
|
|
73
73
|
React.createElement("span", null, t('ta.message.modelSwitched', { model: model.slice(model.indexOf('/') + 1) }))));
|
|
74
74
|
}
|
|
75
|
+
/** Where a restart of ta serve cut the run off and it went on (TA_RESUME_MESSAGE): a mark as where it switched models. */
|
|
76
|
+
export function ResumeBreak() {
|
|
77
|
+
const t = useT();
|
|
78
|
+
return (React.createElement("div", { className: "ta-model-break ta-resume-break" },
|
|
79
|
+
React.createElement(Icon, { icon: RotateCw, size: 12 }),
|
|
80
|
+
React.createElement("span", null, t('ta.message.resumed'))));
|
|
81
|
+
}
|
|
75
82
|
/**
|
|
76
83
|
* Quotes the reply in the message box, or the part of it selected: the button keeps the selection (no focus on
|
|
77
84
|
* a press), and takes it when it is in the same message.
|
|
@@ -64,6 +64,13 @@ export declare function UserSaid({ blocks, text, bubble, timestamp }: {
|
|
|
64
64
|
bubble?: string;
|
|
65
65
|
timestamp?: number;
|
|
66
66
|
}): React.JSX.Element | null;
|
|
67
|
+
/**
|
|
68
|
+
* Where a message of the user came from when not from what they typed (TaMessageSource): the package that sent it, as
|
|
69
|
+
* the user calls it, with what it says besides (the channel and who spoke); the double. None for what they typed.
|
|
70
|
+
*/
|
|
71
|
+
export declare function MessageOrigin({ blocks }: {
|
|
72
|
+
blocks: Blocks;
|
|
73
|
+
}): React.JSX.Element | null;
|
|
67
74
|
/**
|
|
68
75
|
* What a message of the user's shows, in a conversation and the double alike: without the context and the notes of
|
|
69
76
|
* pictures sent with it, a skill they ran (`/skill:name`) taken out of the words as the skill; `copied` is what they typed.
|
|
@@ -77,6 +84,11 @@ export declare function userWords(blocks: Blocks): {
|
|
|
77
84
|
export declare function SkillUse({ skill }: {
|
|
78
85
|
skill: TaSkillUse;
|
|
79
86
|
}): React.JSX.Element;
|
|
87
|
+
/** 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. */
|
|
88
|
+
export declare function UserMarks({ blocks, queued }: {
|
|
89
|
+
blocks: Blocks;
|
|
90
|
+
queued?: boolean;
|
|
91
|
+
}): React.JSX.Element | null;
|
|
80
92
|
/**
|
|
81
93
|
* The head of a turn and its work: the work in one line, "N steps", open while ta is at it, then folded,
|
|
82
94
|
* so that a long conversation reads as what was asked and what came of it. Before the first step the
|
|
@@ -1,12 +1,14 @@
|
|
|
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 {
|
|
6
|
-
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';
|
|
7
8
|
import { Recent } from '../markdown/lazy.js';
|
|
8
9
|
import { MessageUtil } from '../util/message.js';
|
|
9
10
|
import { FreshRows, ProcessUtil } from '../util/process.js';
|
|
11
|
+
import { ProgressUtil } from '../util/progress.js';
|
|
10
12
|
import { ToolUtil } from '../util/tool.js';
|
|
11
13
|
import { Callout } from './callout.js';
|
|
12
14
|
import { ASK_CLASS } from './conversation-scroll.js';
|
|
@@ -178,7 +180,37 @@ export function UserSaid({ blocks, text, bubble = 'ta-bubble', timestamp }) {
|
|
|
178
180
|
React.createElement(UserImages, { blocks: blocks, timestamp: timestamp }),
|
|
179
181
|
text && React.createElement(SaidText, { text: text, className: "ta-bubble-text" })));
|
|
180
182
|
}
|
|
181
|
-
|
|
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 }) {
|
|
182
214
|
const blocks = MessageUtil.blocks(message);
|
|
183
215
|
const said = MessageUtil.text(blocks).trim();
|
|
184
216
|
if (TASK_RENAMED.test(said)) {
|
|
@@ -190,7 +222,7 @@ function UserMessage({ message }) {
|
|
|
190
222
|
return React.createElement(TaskUpdate, { title: update[1], status: update[2], result: update[3] });
|
|
191
223
|
}
|
|
192
224
|
const { text, copied, skill } = userWords(blocks);
|
|
193
|
-
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 });
|
|
194
226
|
}
|
|
195
227
|
/**
|
|
196
228
|
* What a message of the user's shows, in a conversation and the double alike: without the context and the notes of
|
|
@@ -217,17 +249,30 @@ export function SkillUse({ skill }) {
|
|
|
217
249
|
open && (React.createElement("div", { className: "ta-skill-body" },
|
|
218
250
|
React.createElement(Markdown, { text: skill.content.replace(SKILL_BASE, '') })))));
|
|
219
251
|
}
|
|
220
|
-
|
|
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, }) {
|
|
221
263
|
const [menu, onContextMenu] = useMessageMenu({ kind: 'user', message, text: copied });
|
|
264
|
+
const marks = React.createElement(UserMarks, { blocks: blocks, queued: queued });
|
|
222
265
|
const outbox = React.useContext(Outbox);
|
|
223
266
|
const sent = outbox.of.get(message);
|
|
224
267
|
if (sent) {
|
|
225
268
|
// Not in the session yet: nothing to branch from or rewind to.
|
|
226
269
|
return (React.createElement("div", { className: `ta-message ta-user ${sent.failed ? 'ta-user-failed' : 'ta-user-sending'}` },
|
|
270
|
+
marks,
|
|
227
271
|
React.createElement(UserSaid, { blocks: blocks, text: text, timestamp: message.timestamp }),
|
|
228
272
|
sent.failed ? React.createElement(SendFailed, { sent: sent, actions: outbox.actions }) : React.createElement("div", { className: "ta-footer" })));
|
|
229
273
|
}
|
|
230
274
|
return (React.createElement("div", { className: "ta-message ta-user", onContextMenu: onContextMenu },
|
|
275
|
+
marks,
|
|
231
276
|
skill && React.createElement(SkillUse, { skill: skill }),
|
|
232
277
|
React.createElement(UserSaid, { blocks: blocks, text: text, timestamp: message.timestamp }),
|
|
233
278
|
React.createElement(UserFooter, { message: message, text: copied }),
|
|
@@ -262,10 +307,26 @@ const ErrorStep = React.memo(function ErrorStep({ text }) {
|
|
|
262
307
|
return (React.createElement("div", { className: "ta-step-thinking ta-step-error" },
|
|
263
308
|
React.createElement("button", { type: "button", className: "ta-step-toggle", "aria-expanded": open, onClick: () => setOpen(!open) },
|
|
264
309
|
React.createElement("span", { className: "ta-status ta-status-error" }),
|
|
265
|
-
React.createElement("span", { className: "ta-step-tag" }, t('ta.process.
|
|
310
|
+
React.createElement("span", { className: "ta-step-tag" }, t('ta.process.requestFailed')),
|
|
266
311
|
!open && text && React.createElement("span", { className: "ta-step-preview" }, ProcessUtil.preview(text))),
|
|
267
312
|
open && text && React.createElement("div", { className: "ta-thinking-text" }, text)));
|
|
268
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
|
+
});
|
|
269
330
|
const TextStep = React.memo(function TextStep({ text, streaming }) {
|
|
270
331
|
return (React.createElement("div", { className: "ta-step-text" },
|
|
271
332
|
React.createElement("span", { className: "ta-status ta-status-thought" }),
|
|
@@ -282,6 +343,8 @@ function Step({ step, results, tools, tagged, streaming, }) {
|
|
|
282
343
|
return React.createElement(SummaryStep, { text: step.text });
|
|
283
344
|
case 'error':
|
|
284
345
|
return React.createElement(ErrorStep, { text: step.text });
|
|
346
|
+
case 'said':
|
|
347
|
+
return React.createElement(SaidStep, { message: step.message });
|
|
285
348
|
default: {
|
|
286
349
|
const { id = '', name = '', arguments: args } = step.call;
|
|
287
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 }));
|
|
@@ -363,6 +426,8 @@ export function Process({ steps, active, results, tools, leading, status, stoppe
|
|
|
363
426
|
const renderers = React.useContext(CodeRenderers);
|
|
364
427
|
const pinned = open ? [] : steps.filter(step => ProcessUtil.pinned(step, renderers));
|
|
365
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');
|
|
366
431
|
// The earlier steps count as the head does: the calls among them, not the thoughts.
|
|
367
432
|
const earlier = folded.hidden ? ToolUtil.count(ProcessUtil.tools(steps.slice(0, folded.hidden)), results, tools).steps : 0;
|
|
368
433
|
// Only thoughts: the head already says so, the steps need not say it again.
|
|
@@ -380,6 +445,7 @@ export function Process({ steps, active, results, tools, leading, status, stoppe
|
|
|
380
445
|
shown && (React.createElement("div", { id: id, ref: stepsRef, className: "ta-process-steps" },
|
|
381
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'))),
|
|
382
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 }))))),
|
|
383
449
|
pinned.map(step => (React.createElement(Markdown, { key: step.key, text: step.text })))));
|
|
384
450
|
}
|
|
385
451
|
/** A turn that has shown nothing yet: what ta does goes on its head. */
|
|
@@ -395,12 +461,20 @@ export function endsInSteps(item) {
|
|
|
395
461
|
return (item === null || item === void 0 ? void 0 : item.kind) === 'turn' && item.steps.length > 0 && !item.reply.length;
|
|
396
462
|
}
|
|
397
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, }) {
|
|
398
471
|
var _a;
|
|
399
472
|
const t = useT();
|
|
400
473
|
const session = React.useContext(ConversationSession);
|
|
401
474
|
const results = MessageUtil.results(item.messages);
|
|
402
475
|
const { errorMessage } = ((_a = item.last) !== null && _a !== void 0 ? _a : {});
|
|
403
476
|
const ending = ProcessUtil.ending(item);
|
|
477
|
+
const held = useHeld(item.active, ending === 'silent' || ending === 'interrupted');
|
|
404
478
|
const reply = item.reply.join('\n\n').trim();
|
|
405
479
|
const actions = React.useContext(MessageActions);
|
|
406
480
|
const [menu, onContextMenu] = useMessageMenu({
|
|
@@ -413,20 +487,43 @@ function Turn({ item, tools, mood, status, latest, }) {
|
|
|
413
487
|
return (React.createElement("div", { className: `ta-message ta-assistant ${item.active ? 'ta-turn-live' : ''}`, onContextMenu: onContextMenu },
|
|
414
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 }),
|
|
415
489
|
item.reply.map((text, index) => (React.createElement(Markdown, { key: index, text: text, streaming: item.active && index === item.reply.length - 1 }))),
|
|
416
|
-
ending && ending !== 'aborted' && (React.createElement(TurnEnd, { ending: ending, error: errorMessage,
|
|
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 })),
|
|
417
491
|
ending === 'aborted' && React.createElement("div", { className: "ta-muted ta-small" }, t('ta.message.stopped')),
|
|
418
492
|
!item.active && React.createElement(TurnFooter, { messages: item.messages, last: item.last, reply: reply, session: session, latest: latest }),
|
|
419
493
|
menu));
|
|
420
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
|
+
}
|
|
421
518
|
/**
|
|
422
|
-
* Why a turn stopped short, under it: the error
|
|
423
|
-
*
|
|
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.
|
|
424
521
|
*/
|
|
425
|
-
function TurnEnd({ ending, error,
|
|
522
|
+
function TurnEnd({ ending, error, resume }) {
|
|
426
523
|
const t = useT();
|
|
427
524
|
const action = resume && (React.createElement("button", { type: "button", className: "ta-button", onClick: resume }, t('ta.message.resume')));
|
|
428
525
|
if (ending === 'error') {
|
|
429
|
-
return (React.createElement(Callout, { level: "error",
|
|
526
|
+
return (React.createElement(Callout, { level: "error", action: action }, (error === null || error === void 0 ? void 0 : error.trim()) || t('ta.message.failedUnknown')));
|
|
430
527
|
}
|
|
431
528
|
return (React.createElement(Callout, { level: "warning", action: action }, t(ending === 'interrupted' ? 'ta.message.interrupted' : 'ta.message.silent')));
|
|
432
529
|
}
|
|
@@ -442,6 +539,25 @@ function BashMessage({ message }) {
|
|
|
442
539
|
output && (React.createElement("div", { className: "ta-tool-body" },
|
|
443
540
|
React.createElement("pre", { className: "ta-output" }, output))))));
|
|
444
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
|
+
}
|
|
445
561
|
function SummaryMessage({ title, text }) {
|
|
446
562
|
const t = useT();
|
|
447
563
|
return (React.createElement("details", { className: "ta-summary" },
|
|
@@ -453,13 +569,13 @@ function Message({ item }) {
|
|
|
453
569
|
const { message } = item;
|
|
454
570
|
switch (message.role) {
|
|
455
571
|
case 'user':
|
|
456
|
-
return React.createElement(UserMessage, { message: message });
|
|
572
|
+
return React.createElement(UserMessage, { message: message, queued: item.queued });
|
|
457
573
|
case 'bashExecution':
|
|
458
574
|
return React.createElement(BashMessage, { message: message });
|
|
459
575
|
case 'custom':
|
|
460
576
|
return React.createElement(CustomMessage, { message: message });
|
|
461
577
|
case 'compactionSummary':
|
|
462
|
-
return React.createElement(
|
|
578
|
+
return React.createElement(CompactionBreak, { summary: (_a = message.summary) !== null && _a !== void 0 ? _a : '', tokens: message.tokensBefore });
|
|
463
579
|
case 'branchSummary':
|
|
464
580
|
return React.createElement(SummaryMessage, { title: "ta.message.branch", text: (_b = message.summary) !== null && _b !== void 0 ? _b : '' });
|
|
465
581
|
default:
|
|
@@ -477,6 +593,21 @@ const ThreadRow = React.memo(function ThreadRow({ item, tools, mood, status, lat
|
|
|
477
593
|
previous.latest === next.latest &&
|
|
478
594
|
ProcessUtil.same(previous.item, next.item) &&
|
|
479
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
|
+
}
|
|
480
611
|
/** The last rows, which change and are in view, are always laid out. */
|
|
481
612
|
const SETTLED_AFTER = 4;
|
|
482
613
|
/** The conversation; tool results show with the calls they answer. `rows`: only its latest rows are drawn, more as asked. */
|
|
@@ -487,20 +618,19 @@ export function MessageList({ state, outbox, rows }) {
|
|
|
487
618
|
const items = React.useMemo(() => ProcessUtil.items(state.messages, state.working, state.start, renderers), [state.messages, state.working, state.start, renderers]);
|
|
488
619
|
const breaks = React.useMemo(() => ProcessUtil.timeBreaks(ProcessUtil.starts(items), index => ProcessUtil.shown(items[index], renderers)), [items, renderers]);
|
|
489
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]);
|
|
490
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]);
|
|
491
624
|
// The rows held back: those before the latest `rows.rows`.
|
|
492
625
|
const from = rows ? Math.max(0, items.length - rows.rows) : 0;
|
|
493
626
|
if (rows) {
|
|
494
627
|
rows.hidden.current = from;
|
|
495
628
|
}
|
|
496
|
-
// Rows of earlier messages put in front are laid out
|
|
497
|
-
//
|
|
498
|
-
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
var _a;
|
|
502
|
-
firstKey.current = (_a = items[from]) === null || _a === void 0 ? void 0 : _a.key;
|
|
503
|
-
});
|
|
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));
|
|
504
634
|
// Rows that come after the list is drawn come in with a motion; those of a conversation opened or loaded again,
|
|
505
635
|
// and those already there when earlier messages come in front of them, still: by key, not by index.
|
|
506
636
|
const freshRows = React.useRef(undefined);
|
|
@@ -527,7 +657,8 @@ export function MessageList({ state, outbox, rows }) {
|
|
|
527
657
|
.join(' ') },
|
|
528
658
|
breaks[index] !== undefined && React.createElement(TimeBreak, { timestamp: breaks[index] }),
|
|
529
659
|
models[index] && React.createElement(ModelBreak, { model: models[index] }),
|
|
530
|
-
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 }))))),
|
|
531
662
|
status && !onHead && React.createElement("div", { className: `ta-run-line ${endsInSteps(last) ? 'ta-run-steps' : ''}` }, status)));
|
|
532
663
|
}
|
|
533
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';
|
|
@@ -228,7 +229,7 @@ function TabBar({ tabs, tab, onTab }) {
|
|
|
228
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) },
|
|
229
230
|
React.createElement("span", { className: "ta-tabbar-icon" },
|
|
230
231
|
item.double ? React.createElement(DinoFace, { size: 24, className: "ta-nav-face" }) : React.createElement(Glyph, { size: 22, strokeWidth: active ? 2 : 1.6 }),
|
|
231
|
-
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 })),
|
|
232
233
|
React.createElement("span", null, item.label)));
|
|
233
234
|
}),
|
|
234
235
|
menu));
|
|
@@ -237,8 +238,11 @@ export var PhoneUtil;
|
|
|
237
238
|
(function (PhoneUtil) {
|
|
238
239
|
/** Two taps of a tab within this are one double tap. */
|
|
239
240
|
PhoneUtil.DOUBLE_TAP_MS = 350;
|
|
240
|
-
/**
|
|
241
|
-
|
|
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]';
|
|
242
246
|
/** Over the row scrolled to, the room left above it. */
|
|
243
247
|
const GAP = 8;
|
|
244
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;
|