@adecore/agents-react 0.37.2 → 0.38.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/dist/chat/chat-client.d.ts +1 -0
- package/dist/chat/chat-client.js +2 -1
- package/dist/chat/chat-references.d.ts +16 -1
- package/dist/chat/chat-references.js +29 -3
- package/dist/chat/drafts.d.ts +2 -0
- package/dist/chat/drafts.js +21 -5
- package/dist/chat/index.d.ts +1 -1
- package/dist/chat/logic/visual-height.d.ts +1 -0
- package/dist/chat/logic/visual-height.js +1 -1
- package/dist/chat/mentions.d.ts +31 -14
- package/dist/chat/mentions.js +186 -41
- package/dist/chat/stash.d.ts +1 -0
- package/dist/chat/stash.js +4 -2
- package/dist/chat/ui/Composer.js +438 -429
- package/dist/chat/ui/ComposerInput.d.ts +1 -0
- package/dist/chat/ui/ComposerInput.js +2 -0
- package/dist/chat/ui/HostMenuItems.d.ts +4 -0
- package/dist/chat/ui/HostMenuItems.js +15 -0
- package/dist/chat/ui/Markdown.d.ts +3 -1
- package/dist/chat/ui/Markdown.js +194 -120
- package/dist/chat/ui/MessageActions.js +70 -66
- package/dist/chat/ui/ReferenceChip.d.ts +15 -0
- package/dist/chat/ui/ReferenceChip.js +255 -0
- package/dist/chat/ui/Timeline.js +52 -29
- package/dist/chat/ui/TimelineMenu.js +84 -78
- package/dist/chat/ui/VisualFrame.d.ts +8 -0
- package/dist/chat/ui/VisualFrame.js +217 -115
- package/dist/chat/ui/chip-clipboard.d.ts +9 -0
- package/dist/chat/ui/chip-clipboard.js +105 -0
- package/dist/chat/ui/chips.d.ts +5 -0
- package/dist/chat/ui/chips.js +15 -1
- package/dist/chat/ui/composer/ComposerMenu.js +140 -79
- package/dist/chat/ui/composer/DraftParts.d.ts +0 -4
- package/dist/chat/ui/composer/DraftParts.js +0 -41
- package/dist/chat/ui/composer/chip-paste.d.ts +15 -0
- package/dist/chat/ui/composer/chip-paste.js +104 -0
- package/dist/chat/ui/composer/chips.d.ts +5 -0
- package/dist/chat/ui/composer/chips.js +59 -9
- package/dist/chat/ui/composer/key-handler.js +9 -0
- package/dist/chat/ui/composer/use-composer-draft.d.ts +0 -1
- package/dist/chat/ui/composer/use-composer-draft.js +2 -10
- package/dist/chat/ui/composer/use-composer-menus.d.ts +12 -2
- package/dist/chat/ui/composer/use-composer-menus.js +192 -149
- package/dist/chat/ui/composer/use-composer-submit.js +17 -12
- package/dist/chat/ui/composer/use-draft-files.d.ts +7 -1
- package/dist/chat/ui/composer/use-draft-files.js +90 -58
- package/dist/chat/ui/composer/use-take-back.js +2 -1
- package/dist/chat/ui/index.d.ts +1 -1
- package/dist/chat/ui/index.js +1 -1
- package/dist/chat/ui/reference-icons.d.ts +3 -0
- package/dist/chat/ui/reference-icons.js +15 -0
- package/dist/chat/ui/reference-lookup.d.ts +7 -0
- package/dist/chat/ui/reference-lookup.js +6 -0
- package/dist/chat/ui/rehype-chips.d.ts +8 -1
- package/dist/chat/ui/rehype-chips.js +35 -11
- package/dist/chat/ui/rows/GeneratedImageRow.js +8 -4
- package/dist/chat/ui/rows/MessageRows.js +218 -158
- package/dist/chat/ui/rows/VisualRow.js +184 -142
- package/dist/chat/ui/rows/row-rhythm.js +6 -4
- package/dist/chat/ui/thread-references.d.ts +4 -0
- package/dist/chat/ui/thread-references.js +78 -0
- package/dist/host-hooks.d.ts +2 -0
- package/dist/host-hooks.js +7 -0
- package/dist/host.d.ts +14 -1
- package/dist/index.d.ts +1 -1
- package/dist/locales/en/agent-chat.d.ts +20 -3
- package/dist/locales/en/agent-chat.js +24 -7
- package/dist/locales/nl/agent-chat.d.ts +20 -3
- package/dist/locales/nl/agent-chat.js +24 -7
- package/package.json +8 -8
- package/src/chat/chat-client.ts +4 -1
- package/src/chat/chat-references.ts +44 -3
- package/src/chat/drafts.ts +24 -6
- package/src/chat/index.ts +1 -1
- package/src/chat/logic/visual-height.ts +1 -1
- package/src/chat/mentions.ts +202 -36
- package/src/chat/stash.ts +6 -2
- package/src/chat/ui/Composer.tsx +14 -4
- package/src/chat/ui/ComposerInput.tsx +4 -0
- package/src/chat/ui/HostMenuItems.tsx +11 -0
- package/src/chat/ui/Markdown.tsx +57 -25
- package/src/chat/ui/MessageActions.tsx +5 -2
- package/src/chat/ui/ReferenceChip.tsx +74 -0
- package/src/chat/ui/Timeline.tsx +24 -2
- package/src/chat/ui/TimelineMenu.tsx +7 -3
- package/src/chat/ui/VisualFrame.tsx +68 -21
- package/src/chat/ui/chip-clipboard.ts +115 -0
- package/src/chat/ui/chips.ts +20 -1
- package/src/chat/ui/composer/ComposerMenu.tsx +53 -37
- package/src/chat/ui/composer/DraftParts.tsx +0 -12
- package/src/chat/ui/composer/chip-paste.ts +122 -0
- package/src/chat/ui/composer/chips.ts +60 -10
- package/src/chat/ui/composer/key-handler.ts +9 -0
- package/src/chat/ui/composer/use-composer-draft.ts +1 -7
- package/src/chat/ui/composer/use-composer-menus.ts +68 -29
- package/src/chat/ui/composer/use-composer-submit.ts +13 -6
- package/src/chat/ui/composer/use-draft-files.ts +39 -5
- package/src/chat/ui/composer/use-take-back.ts +2 -1
- package/src/chat/ui/index.ts +1 -1
- package/src/chat/ui/reference-icons.ts +17 -0
- package/src/chat/ui/reference-lookup.ts +13 -0
- package/src/chat/ui/rehype-chips.ts +38 -13
- package/src/chat/ui/rows/GeneratedImageRow.tsx +9 -4
- package/src/chat/ui/rows/MessageRows.tsx +88 -64
- package/src/chat/ui/rows/VisualRow.tsx +5 -1
- package/src/chat/ui/rows/row-rhythm.ts +6 -4
- package/src/chat/ui/thread-references.ts +47 -0
- package/src/host-hooks.ts +9 -0
- package/src/host.ts +24 -1
- package/src/index.ts +1 -0
- package/src/locales/en/agent-chat.ts +24 -7
- package/src/locales/nl/agent-chat.ts +24 -7
- package/dist/chat/ui/ChatReferenceChip.d.ts +0 -4
- package/dist/chat/ui/ChatReferenceChip.js +0 -110
- package/src/chat/ui/ChatReferenceChip.tsx +0 -26
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { MessageSquare, X } from 'lucide-react';
|
|
5
|
-
import { CHIP_IN_MESSAGE, MENTION_TONE } from './chips.js';
|
|
6
|
-
import { Icon, Tooltip } from '@adecore/ui';
|
|
7
|
-
import { useHostReferableChats } from '../../host-hooks.js';
|
|
8
|
-
/* A chat attached to a message, under the title it has now rather than the one it had when it was attached. */
|
|
9
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
export function ChatReferenceChip(t0) {
|
|
11
|
-
const $ = _c(19);
|
|
12
|
-
const {
|
|
13
|
-
chatId,
|
|
14
|
-
onRemove
|
|
15
|
-
} = t0;
|
|
16
|
-
const {
|
|
17
|
-
t
|
|
18
|
-
} = useTranslation("agent-chat");
|
|
19
|
-
const t1 = useHostReferableChats();
|
|
20
|
-
let t2;
|
|
21
|
-
if ($[0] !== chatId || $[1] !== t1) {
|
|
22
|
-
let t3;
|
|
23
|
-
if ($[3] !== chatId) {
|
|
24
|
-
t3 = candidate => candidate.id === chatId;
|
|
25
|
-
$[3] = chatId;
|
|
26
|
-
$[4] = t3;
|
|
27
|
-
} else {
|
|
28
|
-
t3 = $[4];
|
|
29
|
-
}
|
|
30
|
-
t2 = t1.find(t3);
|
|
31
|
-
$[0] = chatId;
|
|
32
|
-
$[1] = t1;
|
|
33
|
-
$[2] = t2;
|
|
34
|
-
} else {
|
|
35
|
-
t2 = $[2];
|
|
36
|
-
}
|
|
37
|
-
const chat = t2;
|
|
38
|
-
let t3;
|
|
39
|
-
if ($[5] !== chat || $[6] !== t) {
|
|
40
|
-
t3 = chat === undefined ? t("chatReference.gone") : chat.title || t("chatReference.untitled");
|
|
41
|
-
$[5] = chat;
|
|
42
|
-
$[6] = t;
|
|
43
|
-
$[7] = t3;
|
|
44
|
-
} else {
|
|
45
|
-
t3 = $[7];
|
|
46
|
-
}
|
|
47
|
-
const title = t3;
|
|
48
|
-
let t4;
|
|
49
|
-
let t5;
|
|
50
|
-
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
51
|
-
t4 = clsx(MENTION_TONE, CHIP_IN_MESSAGE);
|
|
52
|
-
t5 = /*#__PURE__*/_jsx(Icon, {
|
|
53
|
-
icon: MessageSquare,
|
|
54
|
-
size: 12,
|
|
55
|
-
className: "shrink-0"
|
|
56
|
-
});
|
|
57
|
-
$[8] = t4;
|
|
58
|
-
$[9] = t5;
|
|
59
|
-
} else {
|
|
60
|
-
t4 = $[8];
|
|
61
|
-
t5 = $[9];
|
|
62
|
-
}
|
|
63
|
-
let t6;
|
|
64
|
-
if ($[10] !== title) {
|
|
65
|
-
t6 = /*#__PURE__*/_jsx("span", {
|
|
66
|
-
className: "truncate",
|
|
67
|
-
children: title
|
|
68
|
-
});
|
|
69
|
-
$[10] = title;
|
|
70
|
-
$[11] = t6;
|
|
71
|
-
} else {
|
|
72
|
-
t6 = $[11];
|
|
73
|
-
}
|
|
74
|
-
let t7;
|
|
75
|
-
if ($[12] !== onRemove || $[13] !== t || $[14] !== title) {
|
|
76
|
-
t7 = onRemove && /*#__PURE__*/_jsx(Tooltip, {
|
|
77
|
-
label: t("chatReference.remove", {
|
|
78
|
-
title
|
|
79
|
-
}),
|
|
80
|
-
name: true,
|
|
81
|
-
children: /*#__PURE__*/_jsx("button", {
|
|
82
|
-
className: "-mr-0.5 shrink-0 rounded-sm opacity-70 hover:opacity-100",
|
|
83
|
-
onClick: onRemove,
|
|
84
|
-
children: /*#__PURE__*/_jsx(Icon, {
|
|
85
|
-
icon: X,
|
|
86
|
-
size: 12
|
|
87
|
-
})
|
|
88
|
-
})
|
|
89
|
-
});
|
|
90
|
-
$[12] = onRemove;
|
|
91
|
-
$[13] = t;
|
|
92
|
-
$[14] = title;
|
|
93
|
-
$[15] = t7;
|
|
94
|
-
} else {
|
|
95
|
-
t7 = $[15];
|
|
96
|
-
}
|
|
97
|
-
let t8;
|
|
98
|
-
if ($[16] !== t6 || $[17] !== t7) {
|
|
99
|
-
t8 = /*#__PURE__*/_jsxs("span", {
|
|
100
|
-
className: t4,
|
|
101
|
-
children: [t5, t6, t7]
|
|
102
|
-
});
|
|
103
|
-
$[16] = t6;
|
|
104
|
-
$[17] = t7;
|
|
105
|
-
$[18] = t8;
|
|
106
|
-
} else {
|
|
107
|
-
t8 = $[18];
|
|
108
|
-
}
|
|
109
|
-
return t8;
|
|
110
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import clsx from 'clsx';
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { MessageSquare, X } from 'lucide-react';
|
|
4
|
-
import { CHIP_IN_MESSAGE, MENTION_TONE } from './chips';
|
|
5
|
-
import { Icon, Tooltip } from '@adecore/ui';
|
|
6
|
-
import { useHostReferableChats } from '../../host-hooks';
|
|
7
|
-
|
|
8
|
-
/* A chat attached to a message, under the title it has now rather than the one it had when it was attached. */
|
|
9
|
-
export function ChatReferenceChip({ chatId, onRemove }: { chatId: string; onRemove?: () => void }) {
|
|
10
|
-
const { t } = useTranslation('agent-chat');
|
|
11
|
-
const chat = useHostReferableChats().find((candidate) => candidate.id === chatId);
|
|
12
|
-
const title = chat === undefined ? t('chatReference.gone') : chat.title || t('chatReference.untitled');
|
|
13
|
-
return (
|
|
14
|
-
<span className={clsx(MENTION_TONE, CHIP_IN_MESSAGE)}>
|
|
15
|
-
<Icon icon={MessageSquare} size={12} className="shrink-0" />
|
|
16
|
-
<span className="truncate">{title}</span>
|
|
17
|
-
{onRemove && (
|
|
18
|
-
<Tooltip label={t('chatReference.remove', { title })} name>
|
|
19
|
-
<button className="-mr-0.5 shrink-0 rounded-sm opacity-70 hover:opacity-100" onClick={onRemove}>
|
|
20
|
-
<Icon icon={X} size={12} />
|
|
21
|
-
</button>
|
|
22
|
-
</Tooltip>
|
|
23
|
-
)}
|
|
24
|
-
</span>
|
|
25
|
-
);
|
|
26
|
-
}
|