@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.
Files changed (115) hide show
  1. package/dist/chat/chat-client.d.ts +1 -0
  2. package/dist/chat/chat-client.js +2 -1
  3. package/dist/chat/chat-references.d.ts +16 -1
  4. package/dist/chat/chat-references.js +29 -3
  5. package/dist/chat/drafts.d.ts +2 -0
  6. package/dist/chat/drafts.js +21 -5
  7. package/dist/chat/index.d.ts +1 -1
  8. package/dist/chat/logic/visual-height.d.ts +1 -0
  9. package/dist/chat/logic/visual-height.js +1 -1
  10. package/dist/chat/mentions.d.ts +31 -14
  11. package/dist/chat/mentions.js +186 -41
  12. package/dist/chat/stash.d.ts +1 -0
  13. package/dist/chat/stash.js +4 -2
  14. package/dist/chat/ui/Composer.js +438 -429
  15. package/dist/chat/ui/ComposerInput.d.ts +1 -0
  16. package/dist/chat/ui/ComposerInput.js +2 -0
  17. package/dist/chat/ui/HostMenuItems.d.ts +4 -0
  18. package/dist/chat/ui/HostMenuItems.js +15 -0
  19. package/dist/chat/ui/Markdown.d.ts +3 -1
  20. package/dist/chat/ui/Markdown.js +194 -120
  21. package/dist/chat/ui/MessageActions.js +70 -66
  22. package/dist/chat/ui/ReferenceChip.d.ts +15 -0
  23. package/dist/chat/ui/ReferenceChip.js +255 -0
  24. package/dist/chat/ui/Timeline.js +52 -29
  25. package/dist/chat/ui/TimelineMenu.js +84 -78
  26. package/dist/chat/ui/VisualFrame.d.ts +8 -0
  27. package/dist/chat/ui/VisualFrame.js +217 -115
  28. package/dist/chat/ui/chip-clipboard.d.ts +9 -0
  29. package/dist/chat/ui/chip-clipboard.js +105 -0
  30. package/dist/chat/ui/chips.d.ts +5 -0
  31. package/dist/chat/ui/chips.js +15 -1
  32. package/dist/chat/ui/composer/ComposerMenu.js +140 -79
  33. package/dist/chat/ui/composer/DraftParts.d.ts +0 -4
  34. package/dist/chat/ui/composer/DraftParts.js +0 -41
  35. package/dist/chat/ui/composer/chip-paste.d.ts +15 -0
  36. package/dist/chat/ui/composer/chip-paste.js +104 -0
  37. package/dist/chat/ui/composer/chips.d.ts +5 -0
  38. package/dist/chat/ui/composer/chips.js +59 -9
  39. package/dist/chat/ui/composer/key-handler.js +9 -0
  40. package/dist/chat/ui/composer/use-composer-draft.d.ts +0 -1
  41. package/dist/chat/ui/composer/use-composer-draft.js +2 -10
  42. package/dist/chat/ui/composer/use-composer-menus.d.ts +12 -2
  43. package/dist/chat/ui/composer/use-composer-menus.js +192 -149
  44. package/dist/chat/ui/composer/use-composer-submit.js +17 -12
  45. package/dist/chat/ui/composer/use-draft-files.d.ts +7 -1
  46. package/dist/chat/ui/composer/use-draft-files.js +90 -58
  47. package/dist/chat/ui/composer/use-take-back.js +2 -1
  48. package/dist/chat/ui/index.d.ts +1 -1
  49. package/dist/chat/ui/index.js +1 -1
  50. package/dist/chat/ui/reference-icons.d.ts +3 -0
  51. package/dist/chat/ui/reference-icons.js +15 -0
  52. package/dist/chat/ui/reference-lookup.d.ts +7 -0
  53. package/dist/chat/ui/reference-lookup.js +6 -0
  54. package/dist/chat/ui/rehype-chips.d.ts +8 -1
  55. package/dist/chat/ui/rehype-chips.js +35 -11
  56. package/dist/chat/ui/rows/GeneratedImageRow.js +8 -4
  57. package/dist/chat/ui/rows/MessageRows.js +218 -158
  58. package/dist/chat/ui/rows/VisualRow.js +184 -142
  59. package/dist/chat/ui/rows/row-rhythm.js +6 -4
  60. package/dist/chat/ui/thread-references.d.ts +4 -0
  61. package/dist/chat/ui/thread-references.js +78 -0
  62. package/dist/host-hooks.d.ts +2 -0
  63. package/dist/host-hooks.js +7 -0
  64. package/dist/host.d.ts +14 -1
  65. package/dist/index.d.ts +1 -1
  66. package/dist/locales/en/agent-chat.d.ts +20 -3
  67. package/dist/locales/en/agent-chat.js +24 -7
  68. package/dist/locales/nl/agent-chat.d.ts +20 -3
  69. package/dist/locales/nl/agent-chat.js +24 -7
  70. package/package.json +8 -8
  71. package/src/chat/chat-client.ts +4 -1
  72. package/src/chat/chat-references.ts +44 -3
  73. package/src/chat/drafts.ts +24 -6
  74. package/src/chat/index.ts +1 -1
  75. package/src/chat/logic/visual-height.ts +1 -1
  76. package/src/chat/mentions.ts +202 -36
  77. package/src/chat/stash.ts +6 -2
  78. package/src/chat/ui/Composer.tsx +14 -4
  79. package/src/chat/ui/ComposerInput.tsx +4 -0
  80. package/src/chat/ui/HostMenuItems.tsx +11 -0
  81. package/src/chat/ui/Markdown.tsx +57 -25
  82. package/src/chat/ui/MessageActions.tsx +5 -2
  83. package/src/chat/ui/ReferenceChip.tsx +74 -0
  84. package/src/chat/ui/Timeline.tsx +24 -2
  85. package/src/chat/ui/TimelineMenu.tsx +7 -3
  86. package/src/chat/ui/VisualFrame.tsx +68 -21
  87. package/src/chat/ui/chip-clipboard.ts +115 -0
  88. package/src/chat/ui/chips.ts +20 -1
  89. package/src/chat/ui/composer/ComposerMenu.tsx +53 -37
  90. package/src/chat/ui/composer/DraftParts.tsx +0 -12
  91. package/src/chat/ui/composer/chip-paste.ts +122 -0
  92. package/src/chat/ui/composer/chips.ts +60 -10
  93. package/src/chat/ui/composer/key-handler.ts +9 -0
  94. package/src/chat/ui/composer/use-composer-draft.ts +1 -7
  95. package/src/chat/ui/composer/use-composer-menus.ts +68 -29
  96. package/src/chat/ui/composer/use-composer-submit.ts +13 -6
  97. package/src/chat/ui/composer/use-draft-files.ts +39 -5
  98. package/src/chat/ui/composer/use-take-back.ts +2 -1
  99. package/src/chat/ui/index.ts +1 -1
  100. package/src/chat/ui/reference-icons.ts +17 -0
  101. package/src/chat/ui/reference-lookup.ts +13 -0
  102. package/src/chat/ui/rehype-chips.ts +38 -13
  103. package/src/chat/ui/rows/GeneratedImageRow.tsx +9 -4
  104. package/src/chat/ui/rows/MessageRows.tsx +88 -64
  105. package/src/chat/ui/rows/VisualRow.tsx +5 -1
  106. package/src/chat/ui/rows/row-rhythm.ts +6 -4
  107. package/src/chat/ui/thread-references.ts +47 -0
  108. package/src/host-hooks.ts +9 -0
  109. package/src/host.ts +24 -1
  110. package/src/index.ts +1 -0
  111. package/src/locales/en/agent-chat.ts +24 -7
  112. package/src/locales/nl/agent-chat.ts +24 -7
  113. package/dist/chat/ui/ChatReferenceChip.d.ts +0 -4
  114. package/dist/chat/ui/ChatReferenceChip.js +0 -110
  115. package/src/chat/ui/ChatReferenceChip.tsx +0 -26
@@ -1,4 +0,0 @@
1
- export declare function ChatReferenceChip({ chatId, onRemove }: {
2
- chatId: string;
3
- onRemove?: () => void;
4
- }): import("react").JSX.Element;
@@ -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
- }