@inkeep/agents-ui 0.16.1 → 0.16.3
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/index.cjs +1 -1
- package/dist/index.js +167 -161
- package/dist/primitives/atoms/icons/built-in-icons.cjs +1 -1
- package/dist/primitives/atoms/icons/built-in-icons.d.ts +4 -1
- package/dist/primitives/atoms/icons/built-in-icons.js +94 -91
- package/dist/primitives/atoms/icons/collections/pi.cjs +1 -1
- package/dist/primitives/atoms/icons/collections/pi.d.ts +3 -0
- package/dist/primitives/atoms/icons/collections/pi.js +82 -37
- package/dist/primitives/atoms/icons/inkeep-default-icons.cjs +1 -1
- package/dist/primitives/atoms/icons/inkeep-default-icons.js +4 -1
- package/dist/primitives/components/embedded-chat/file-upload-input.cjs +1 -1
- package/dist/primitives/components/embedded-chat/file-upload-input.d.ts +0 -1
- package/dist/primitives/components/embedded-chat/file-upload-input.js +346 -207
- package/dist/primitives/components/embedded-chat/use-chat-action.cjs +1 -1
- package/dist/primitives/components/embedded-chat/use-chat-action.js +16 -14
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +2 -2
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +257 -256
- package/dist/primitives/components/embedded-chat.cjs +3 -3
- package/dist/primitives/components/embedded-chat.d.ts +1 -1
- package/dist/primitives/components/embedded-chat.js +102 -94
- package/dist/primitives/components/tagline-logo-icon.js +50 -9
- package/dist/primitives/hooks/use-events-api.cjs +1 -0
- package/dist/primitives/hooks/use-events-api.d.ts +31 -0
- package/dist/primitives/hooks/use-events-api.js +44 -0
- package/dist/primitives/hooks/use-feedback-api.cjs +1 -1
- package/dist/primitives/hooks/use-feedback-api.d.ts +3 -1
- package/dist/primitives/hooks/use-feedback-api.js +22 -21
- package/dist/primitives/hooks/use-initial-conversation.js +4 -1
- package/dist/primitives/hooks/use-input-notification.js +9 -9
- package/dist/primitives/index.cjs +1 -1
- package/dist/primitives/index.js +150 -144
- package/dist/primitives/providers/base-events-provider.cjs +1 -1
- package/dist/primitives/providers/base-events-provider.d.ts +2 -0
- package/dist/primitives/providers/base-events-provider.js +6 -5
- package/dist/primitives/providers/chat-auth-provider.cjs +1 -0
- package/dist/primitives/providers/chat-auth-provider.d.ts +27 -0
- package/dist/primitives/providers/chat-auth-provider.js +46 -0
- package/dist/primitives/providers/chat-base-events-provider.cjs +1 -0
- package/dist/primitives/providers/chat-base-events-provider.d.ts +12 -0
- package/dist/primitives/providers/chat-base-events-provider.js +74 -0
- package/dist/primitives/providers/feedback-provider.cjs +1 -1
- package/dist/primitives/providers/feedback-provider.js +37 -30
- package/dist/primitives/providers/index.cjs +1 -1
- package/dist/primitives/providers/index.d.ts +2 -0
- package/dist/primitives/providers/index.js +57 -51
- package/dist/react/embedded-chat.cjs +1 -1
- package/dist/react/embedded-chat.js +101 -99
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +167 -161
- package/dist/styled/components/embedded-chat/image-preview-modal.js +9 -2
- package/dist/styled/components/embedded-chat.js +14 -2
- package/dist/styled/components/embedded-search.js +7 -1
- package/dist/styled/components/message.cjs +1 -1
- package/dist/styled/components/message.js +74 -71
- package/dist/styled/index.cjs +1 -1
- package/dist/styled/index.js +155 -149
- package/dist/types/config/ai.d.ts +5 -0
- package/dist/types/events.d.ts +11 -0
- package/dist/types/icons/built-in.d.ts +1 -1
- package/dist/types/icons/custom.d.ts +3 -0
- package/package.json +2 -2
package/dist/react/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { InkeepEmbeddedChat as S, InkeepEmbeddedChatImpl as c, InkeepEmbeddedChatImplContent as
|
|
2
|
-
import { InkeepSidebarChat as
|
|
1
|
+
import { InkeepEmbeddedChat as S, InkeepEmbeddedChatImpl as c, InkeepEmbeddedChatImplContent as v, InkeepEmbeddedChatProvider as P } from "./embedded-chat.js";
|
|
2
|
+
import { InkeepSidebarChat as B } from "./sidebar-chat.js";
|
|
3
3
|
import { InkeepEmbeddedSearchAndChat as g, InkeepEmbeddedSearchAndChatImpl as E } from "./embedded-search-and-chat.js";
|
|
4
|
-
import { InkeepEmbeddedSearch as F, InkeepEmbeddedSearchImpl as H, InkeepEmbeddedSearchImplContent as w, InkeepEmbeddedSearchProvider as
|
|
4
|
+
import { InkeepEmbeddedSearch as F, InkeepEmbeddedSearchImpl as H, InkeepEmbeddedSearchImplContent as w, InkeepEmbeddedSearchProvider as A } from "./embedded-search.js";
|
|
5
5
|
import { InkeepModalChat as R } from "./modal.chat.js";
|
|
6
6
|
import { InkeepModalSearchAndChat as T } from "./modal.search-and-chat.js";
|
|
7
7
|
import { InkeepModalSearch as W } from "./modal.search.js";
|
|
@@ -22,88 +22,93 @@ import { LoadingIndicator as _ } from "../styled/components/loading-indicator.js
|
|
|
22
22
|
import { widgetToggle as oe } from "../styled/components/ui/recipes/widget-toggle.js";
|
|
23
23
|
import { DefaultToolComponent as te, EmbeddedChatMessagePart as ae } from "../styled/components/message.js";
|
|
24
24
|
import { DataSummaryGroup as de } from "../styled/components/data-summary-group.js";
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
25
|
+
import { BaseEventsContext as se, BaseEventsProvider as ie, useBaseEvents as ne } from "../primitives/providers/base-events-provider.js";
|
|
26
|
+
import { ChatAuthProvider as he, useChatAuth as fe } from "../primitives/providers/chat-auth-provider.js";
|
|
27
|
+
import { ChatBaseEventsProvider as ue } from "../primitives/providers/chat-base-events-provider.js";
|
|
28
|
+
import { ChatFormProvider as Ie, useChatForm as be, useChatFormState as Se } from "../primitives/providers/chat-form-provider.js";
|
|
29
|
+
import { ChatHistoryProvider as ve, useChatHistory as Pe } from "../primitives/providers/chat-history-provider.js";
|
|
30
|
+
import { InkeepConfigProvider as Be, WebWidgetInteractionType as Me, useInkeepConfig as ge } from "../primitives/providers/config-provider.js";
|
|
31
|
+
import { FeedbackProvider as ye, useMessageFeedback as Fe } from "../primitives/providers/feedback-provider.js";
|
|
32
|
+
import { FormFieldProvider as we, useFormField as Ae } from "../primitives/providers/form-field-provider.js";
|
|
33
|
+
import { HelpMenuProvider as Re, useHelpMenu as $e, useHelpMenuState as Te } from "../primitives/providers/help-menu-provider.js";
|
|
34
|
+
import { ChatMarkdownProvider as We, useChatMarkdown as ze } from "../primitives/providers/markdown-provider.js";
|
|
35
|
+
import { MessageProvider as je, useMessage as Ge, useOptionalMessage as Ke } from "../primitives/providers/message-provider.js";
|
|
36
|
+
import { RootProvider as Qe } from "../primitives/providers/root-provider.js";
|
|
37
|
+
import { SourceItemProvider as Ve, useSourceItem as qe } from "../primitives/providers/source-item-provider.js";
|
|
38
|
+
import { ThemeProvider as Xe } from "../primitives/providers/theme-provider.js";
|
|
39
|
+
import { WidgetProvider as Ze, useWidget as _e } from "../primitives/providers/widget-provider.js";
|
|
40
|
+
import { SidebarChatProvider as oo, useInkeepSidebarChat as ro, useOptionalSidebarChat as to, useSidebarChat as ao } from "../primitives/providers/sidebar-chat-provider.js";
|
|
41
|
+
import { ChatBubbleProvider as po, useChatBubble as so, useInkeepChatBubble as io, useOptionalChatBubble as no } from "../primitives/providers/chat-bubble-provider.js";
|
|
42
|
+
import { ikp as ho, jsxFactory as fo } from "../primitives/components/factory.js";
|
|
41
43
|
import * as s from "../primitives/components/embedded-chat.js";
|
|
42
44
|
import * as i from "../primitives/components/sidebar-chat/index.js";
|
|
43
|
-
import { ChatProvider as
|
|
45
|
+
import { ChatProvider as uo, useChat as lo } from "../primitives/components/embedded-chat/chat-provider.js";
|
|
44
46
|
import * as n from "../primitives/components/embedded-search.js";
|
|
45
|
-
import { SearchProvider as
|
|
47
|
+
import { SearchProvider as bo, SearchProviderImpl as So, useSearch as co } from "../primitives/components/embedded-search/search-provider.js";
|
|
46
48
|
import * as C from "../primitives/components/modal.js";
|
|
47
|
-
import { ModalProvider as
|
|
48
|
-
import * as
|
|
49
|
-
import * as
|
|
49
|
+
import { ModalProvider as Po, useModal as ko } from "../primitives/components/modal/modal-provider.js";
|
|
50
|
+
import * as h from "../primitives/components/chat-button.js";
|
|
51
|
+
import * as f from "../primitives/components/searchbar.js";
|
|
50
52
|
import * as x from "../primitives/components/chat-bubble/index.js";
|
|
51
53
|
import * as u from "../primitives/components/data-summaries.js";
|
|
52
54
|
import * as l from "../primitives/components/chat-history/index.js";
|
|
53
|
-
import { useBoolean as
|
|
54
|
-
import { useComponentClassNames as
|
|
55
|
-
import { useContainerSize as
|
|
56
|
-
import { useInkeepOpenState as
|
|
57
|
-
import { useCopyToClipboard as
|
|
58
|
-
import { useInstantUpdate as
|
|
59
|
-
import { useIsMounted as
|
|
60
|
-
import { useMediaQuery as
|
|
61
|
-
import { useResizeObserver as
|
|
62
|
-
import { useScrollingFades as
|
|
63
|
-
import { useSettleAction as
|
|
64
|
-
import { useSimpleScroll as
|
|
65
|
-
import { callAll as
|
|
66
|
-
import { ChatBubbleComponentIds as
|
|
67
|
-
import { composeRefs as
|
|
68
|
-
import { mergeProps as
|
|
69
|
-
import { Portal as
|
|
70
|
-
import { CustomIcon as
|
|
71
|
-
import { BuiltInIconRenderer as
|
|
72
|
-
import { PortalWithTheme as
|
|
73
|
-
import { Command as
|
|
74
|
-
import { ErrorBoundary as
|
|
75
|
-
import { ColorMode as
|
|
76
|
-
import { InkeepShadow as
|
|
55
|
+
import { useBoolean as Mo } from "../primitives/hooks/use-boolean.js";
|
|
56
|
+
import { useComponentClassNames as Eo } from "../primitives/hooks/use-component-classnames.js";
|
|
57
|
+
import { useContainerSize as Fo } from "../primitives/hooks/use-container-size.js";
|
|
58
|
+
import { useInkeepOpenState as wo } from "../primitives/hooks/use-inkeep-open-state.js";
|
|
59
|
+
import { useCopyToClipboard as Do } from "../primitives/hooks/use-copy-to-clipboard.js";
|
|
60
|
+
import { useInstantUpdate as $o } from "../primitives/hooks/use-instant-update.js";
|
|
61
|
+
import { useIsMounted as Oo } from "../primitives/hooks/use-is-mounted.js";
|
|
62
|
+
import { useMediaQuery as zo } from "../primitives/hooks/use-media-query.js";
|
|
63
|
+
import { useResizeObserver as jo } from "../primitives/hooks/use-resize-observer.js";
|
|
64
|
+
import { useScrollingFades as Ko, useScrollingFadesHorizontal as No } from "../primitives/hooks/use-scrolling-fades.js";
|
|
65
|
+
import { useSettleAction as Uo } from "../primitives/hooks/use-settle-action.js";
|
|
66
|
+
import { useSimpleScroll as qo } from "../primitives/hooks/use-simple-scroll.js";
|
|
67
|
+
import { callAll as Xo, dataAttr as Yo, getInitials as Zo, getMessageContent as _o, isCitationArtifact as er, isString as or, maybeRender as rr, toKebabCase as tr } from "../primitives/utils/misc.js";
|
|
68
|
+
import { ChatBubbleComponentIds as mr, DataSummaryComponentIds as dr, SearchBarComponentIds as pr, SidebarChatComponentIds as sr, aiChatComponentIds as ir, aiChatHistoryComponentIds as nr, aiSearchComponentIds as Cr, chatButtonComponentIds as hr, componentIDs as fr, markDownComponentIds as xr, miscellanousComponentIds as ur, modalComponentIds as lr } from "../primitives/utils/component-ids.js";
|
|
69
|
+
import { composeRefs as br, useComposedRefs as Sr } from "../primitives/utils/compose-refs.js";
|
|
70
|
+
import { mergeProps as vr } from "../primitives/utils/merge-props.js";
|
|
71
|
+
import { Portal as kr } from "../primitives/atoms/portal.js";
|
|
72
|
+
import { CustomIcon as Mr } from "../primitives/atoms/icons/custom-icon.js";
|
|
73
|
+
import { BuiltInIconRenderer as Er } from "../primitives/atoms/icons/built-in-icon-renderer.js";
|
|
74
|
+
import { PortalWithTheme as Fr } from "../primitives/atoms/portal-with-theme.js";
|
|
75
|
+
import { Command as wr, CommandDialog as Ar, CommandEmpty as Dr, CommandInput as Rr, CommandItem as $r, CommandList as Tr, CommandLoading as Or, CommandRoot as Wr, CommandSeparator as zr, defaultFilter as Lr, useCommandState as jr, useCommandStore as Gr } from "../primitives/atoms/cmdk/index.js";
|
|
76
|
+
import { ErrorBoundary as Nr } from "../primitives/atoms/error-boundary.js";
|
|
77
|
+
import { ColorMode as Ur, ColorModeProvider as Vr, DarkModeProvider as qr, useColorMode as Jr, useColorModeValue as Xr } from "../color-mode/index.js";
|
|
78
|
+
import { InkeepShadow as Zr, InkeepShadowProvider as _r, ShadowContext as et, useShadow as ot } from "../primitives/atoms/shadow/context.js";
|
|
77
79
|
export {
|
|
78
|
-
se as
|
|
79
|
-
|
|
80
|
+
se as BaseEventsContext,
|
|
81
|
+
ie as BaseEventsProvider,
|
|
82
|
+
Er as BuiltInIconRenderer,
|
|
83
|
+
he as ChatAuthProvider,
|
|
84
|
+
ue as ChatBaseEventsProvider,
|
|
80
85
|
t as ChatBubble,
|
|
81
|
-
|
|
86
|
+
mr as ChatBubbleComponentIds,
|
|
82
87
|
x as ChatBubblePrimitive,
|
|
83
|
-
|
|
88
|
+
po as ChatBubbleProvider,
|
|
84
89
|
d as ChatButton,
|
|
85
90
|
K as ChatButtonImpl,
|
|
86
|
-
|
|
87
|
-
|
|
91
|
+
h as ChatButtonPrimitive,
|
|
92
|
+
Ie as ChatFormProvider,
|
|
88
93
|
o as ChatHistory,
|
|
89
94
|
l as ChatHistoryPrimitive,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
95
|
+
ve as ChatHistoryProvider,
|
|
96
|
+
We as ChatMarkdownProvider,
|
|
97
|
+
uo as ChatProvider,
|
|
98
|
+
Ur as ColorMode,
|
|
99
|
+
Vr as ColorModeProvider,
|
|
100
|
+
wr as Command,
|
|
101
|
+
Ar as CommandDialog,
|
|
102
|
+
Dr as CommandEmpty,
|
|
103
|
+
Rr as CommandInput,
|
|
104
|
+
$r as CommandItem,
|
|
105
|
+
Tr as CommandList,
|
|
106
|
+
Or as CommandLoading,
|
|
107
|
+
Wr as CommandRoot,
|
|
108
|
+
zr as CommandSeparator,
|
|
109
|
+
Mr as CustomIcon,
|
|
110
|
+
qr as DarkModeProvider,
|
|
111
|
+
dr as DataSummaryComponentIds,
|
|
107
112
|
de as DataSummaryGroup,
|
|
108
113
|
u as DataSummaryPrimitive,
|
|
109
114
|
te as DefaultToolComponent,
|
|
@@ -112,118 +117,119 @@ export {
|
|
|
112
117
|
s as EmbeddedChatPrimitive,
|
|
113
118
|
a as EmbeddedSearch,
|
|
114
119
|
n as EmbeddedSearchPrimitive,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
Nr as ErrorBoundary,
|
|
121
|
+
ye as FeedbackProvider,
|
|
122
|
+
we as FormFieldProvider,
|
|
123
|
+
Re as HelpMenuProvider,
|
|
119
124
|
N as InkeepChatButton,
|
|
120
125
|
U as InkeepChatButtonModal,
|
|
121
|
-
|
|
126
|
+
Be as InkeepConfigProvider,
|
|
122
127
|
S as InkeepEmbeddedChat,
|
|
123
128
|
c as InkeepEmbeddedChatImpl,
|
|
124
|
-
|
|
125
|
-
|
|
129
|
+
v as InkeepEmbeddedChatImplContent,
|
|
130
|
+
P as InkeepEmbeddedChatProvider,
|
|
126
131
|
F as InkeepEmbeddedSearch,
|
|
127
132
|
g as InkeepEmbeddedSearchAndChat,
|
|
128
133
|
E as InkeepEmbeddedSearchAndChatImpl,
|
|
129
134
|
H as InkeepEmbeddedSearchImpl,
|
|
130
135
|
w as InkeepEmbeddedSearchImplContent,
|
|
131
|
-
|
|
136
|
+
A as InkeepEmbeddedSearchProvider,
|
|
132
137
|
L as InkeepModal,
|
|
133
138
|
R as InkeepModalChat,
|
|
134
139
|
W as InkeepModalSearch,
|
|
135
140
|
T as InkeepModalSearchAndChat,
|
|
136
141
|
q as InkeepSearchBar,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
142
|
+
Zr as InkeepShadow,
|
|
143
|
+
_r as InkeepShadowProvider,
|
|
144
|
+
B as InkeepSidebarChat,
|
|
140
145
|
_ as LoadingIndicator,
|
|
141
|
-
|
|
146
|
+
je as MessageProvider,
|
|
142
147
|
m as Modal,
|
|
143
148
|
j as ModalContent,
|
|
144
149
|
C as ModalPrimitive,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
150
|
+
Po as ModalProvider,
|
|
151
|
+
kr as Portal,
|
|
152
|
+
Fr as PortalWithTheme,
|
|
153
|
+
Qe as RootProvider,
|
|
149
154
|
p as SearchBar,
|
|
150
|
-
|
|
155
|
+
pr as SearchBarComponentIds,
|
|
151
156
|
J as SearchBarImpl,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
157
|
+
f as SearchBarPrimitive,
|
|
158
|
+
bo as SearchProvider,
|
|
159
|
+
So as SearchProviderImpl,
|
|
155
160
|
Y as Shadow,
|
|
156
|
-
|
|
161
|
+
et as ShadowContext,
|
|
157
162
|
r as SidebarChat,
|
|
158
|
-
|
|
163
|
+
sr as SidebarChatComponentIds,
|
|
159
164
|
i as SidebarChatPrimitive,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
165
|
+
oo as SidebarChatProvider,
|
|
166
|
+
Ve as SourceItemProvider,
|
|
167
|
+
Xe as ThemeProvider,
|
|
168
|
+
Me as WebWidgetInteractionType,
|
|
169
|
+
Ze as WidgetProvider,
|
|
170
|
+
ir as aiChatComponentIds,
|
|
171
|
+
nr as aiChatHistoryComponentIds,
|
|
172
|
+
Cr as aiSearchComponentIds,
|
|
173
|
+
Xo as callAll,
|
|
174
|
+
hr as chatButtonComponentIds,
|
|
175
|
+
fr as componentIDs,
|
|
176
|
+
br as composeRefs,
|
|
177
|
+
Yo as dataAttr,
|
|
178
|
+
Lr as defaultFilter,
|
|
179
|
+
Zo as getInitials,
|
|
180
|
+
_o as getMessageContent,
|
|
181
|
+
ho as ikp,
|
|
182
|
+
er as isCitationArtifact,
|
|
183
|
+
or as isString,
|
|
184
|
+
fo as jsxFactory,
|
|
185
|
+
xr as markDownComponentIds,
|
|
186
|
+
rr as maybeRender,
|
|
187
|
+
vr as mergeProps,
|
|
188
|
+
ur as miscellanousComponentIds,
|
|
189
|
+
lr as modalComponentIds,
|
|
190
|
+
tr as toKebabCase,
|
|
191
|
+
ne as useBaseEvents,
|
|
192
|
+
Mo as useBoolean,
|
|
193
|
+
lo as useChat,
|
|
194
|
+
fe as useChatAuth,
|
|
195
|
+
so as useChatBubble,
|
|
196
|
+
be as useChatForm,
|
|
197
|
+
Se as useChatFormState,
|
|
198
|
+
Pe as useChatHistory,
|
|
199
|
+
ze as useChatMarkdown,
|
|
200
|
+
Jr as useColorMode,
|
|
201
|
+
Xr as useColorModeValue,
|
|
202
|
+
jr as useCommandState,
|
|
203
|
+
Gr as useCommandStore,
|
|
204
|
+
Eo as useComponentClassNames,
|
|
205
|
+
Sr as useComposedRefs,
|
|
206
|
+
Fo as useContainerSize,
|
|
207
|
+
Do as useCopyToClipboard,
|
|
208
|
+
Ae as useFormField,
|
|
209
|
+
$e as useHelpMenu,
|
|
210
|
+
Te as useHelpMenuState,
|
|
211
|
+
io as useInkeepChatBubble,
|
|
212
|
+
ge as useInkeepConfig,
|
|
213
|
+
wo as useInkeepOpenState,
|
|
214
|
+
ro as useInkeepSidebarChat,
|
|
215
|
+
$o as useInstantUpdate,
|
|
216
|
+
Oo as useIsMounted,
|
|
217
|
+
zo as useMediaQuery,
|
|
218
|
+
Ge as useMessage,
|
|
219
|
+
Fe as useMessageFeedback,
|
|
220
|
+
ko as useModal,
|
|
221
|
+
no as useOptionalChatBubble,
|
|
222
|
+
Ke as useOptionalMessage,
|
|
223
|
+
to as useOptionalSidebarChat,
|
|
224
|
+
jo as useResizeObserver,
|
|
225
|
+
Ko as useScrollingFades,
|
|
226
|
+
No as useScrollingFadesHorizontal,
|
|
227
|
+
co as useSearch,
|
|
228
|
+
Uo as useSettleAction,
|
|
229
|
+
ot as useShadow,
|
|
230
|
+
ao as useSidebarChat,
|
|
231
|
+
qo as useSimpleScroll,
|
|
232
|
+
qe as useSourceItem,
|
|
233
|
+
_e as useWidget,
|
|
228
234
|
oe as widgetToggle
|
|
229
235
|
};
|
|
@@ -34,7 +34,10 @@ const P = i, b = ({
|
|
|
34
34
|
}) => /* @__PURE__ */ t(
|
|
35
35
|
n,
|
|
36
36
|
{
|
|
37
|
-
className: m(
|
|
37
|
+
className: m(
|
|
38
|
+
"max-w-[calc(100vw_-_theme(spacing.20))] max-h-[calc(100vh_-_theme(spacing.20))] object-contain rounded-lg",
|
|
39
|
+
e
|
|
40
|
+
),
|
|
38
41
|
...a
|
|
39
42
|
}
|
|
40
43
|
), I = ({
|
|
@@ -62,7 +65,11 @@ const P = i, b = ({
|
|
|
62
65
|
r,
|
|
63
66
|
{
|
|
64
67
|
"aria-label": "Close preview",
|
|
65
|
-
className: m(
|
|
68
|
+
className: m(
|
|
69
|
+
d({ slot: "close" }),
|
|
70
|
+
"fixed top-2 right-2 text-gray-700 dark:text-gray-50 hover:bg-white-alpha-100",
|
|
71
|
+
e
|
|
72
|
+
),
|
|
66
73
|
...a
|
|
67
74
|
}
|
|
68
75
|
);
|
|
@@ -778,7 +778,13 @@ const Wa = Xt, Qa = C(
|
|
|
778
778
|
{
|
|
779
779
|
className: d("inline-flex items-center", e),
|
|
780
780
|
...t,
|
|
781
|
-
children: /* @__PURE__ */ a(
|
|
781
|
+
children: /* @__PURE__ */ a(
|
|
782
|
+
ma,
|
|
783
|
+
{
|
|
784
|
+
className: "text-gray-500 dark:text-white-alpha-600 ml-1 mt-0.5 w-11 h-auto",
|
|
785
|
+
"aria-hidden": "true"
|
|
786
|
+
}
|
|
787
|
+
)
|
|
782
788
|
}
|
|
783
789
|
), u = d(
|
|
784
790
|
o({ size: "xs", variant: "outline" }),
|
|
@@ -913,7 +919,13 @@ const Wa = Xt, Qa = C(
|
|
|
913
919
|
}) => /* @__PURE__ */ a(le, { className: d("flex flex-col gap-8", e), ...t }), uo = ({
|
|
914
920
|
className: e,
|
|
915
921
|
...t
|
|
916
|
-
}) => /* @__PURE__ */ a(
|
|
922
|
+
}) => /* @__PURE__ */ a(
|
|
923
|
+
me,
|
|
924
|
+
{
|
|
925
|
+
className: d("flex flex-col gap-2", e),
|
|
926
|
+
...t
|
|
927
|
+
}
|
|
928
|
+
), go = ({
|
|
917
929
|
className: e,
|
|
918
930
|
...t
|
|
919
931
|
}) => /* @__PURE__ */ a(
|
|
@@ -605,7 +605,13 @@ const ke = (e) => /* @__PURE__ */ a(ie, { ...e }), Re = ({ className: e, ...t })
|
|
|
605
605
|
{
|
|
606
606
|
className: r("inline-flex items-center", e),
|
|
607
607
|
...t,
|
|
608
|
-
children: /* @__PURE__ */ a(
|
|
608
|
+
children: /* @__PURE__ */ a(
|
|
609
|
+
de,
|
|
610
|
+
{
|
|
611
|
+
className: "text-gray-500 dark:text-white-alpha-600 ml-1 mt-0.5 w-11 h-auto",
|
|
612
|
+
"aria-hidden": "true"
|
|
613
|
+
}
|
|
614
|
+
)
|
|
609
615
|
}
|
|
610
616
|
);
|
|
611
617
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),ae=require("../../primitives/providers/base-events-provider.cjs"),re=require("../../primitives/providers/config-provider.cjs"),se=require("../../primitives/providers/message-provider.cjs"),C=require("../../primitives/components/embedded-chat.cjs"),ne=require("../../primitives/components/embedded-chat/chat-provider.cjs"),oe=require("../../primitives/utils/misc.cjs"),ie=require("merge-anything"),b=require("../utils.cjs"),le=require("./ui/markdown-styles.cjs"),de=require("../../primitives/components/embedded-chat/use-stream-processor.cjs"),ce=require("./data-summary-group.cjs"),o=require("react"),T=require("./embedded-chat.cjs"),d=require("lucide-react"),V=require("./ui/recipes/button.cjs"),pe={"input-streaming":"Pending","input-available":"Running","approval-requested":"Awaiting Approval","approval-responded":"Responded","output-available":"Completed","output-error":"Error","output-denied":"Denied"};function ue(t){if(!t||typeof t!="object")return!1;const a=t;return typeof a.type=="string"&&a.type.startsWith("tool-")}const me=t=>{if(!t||typeof t!="object"||!("status"in t))return;const a=t.status;return typeof a=="string"?a:void 0},xe=()=>e.jsx("div",{className:"flex space-x-1",children:[0,1,2].map(t=>e.jsx("span",{className:"animate-bounce-dot opacity-30",style:{animationDelay:`${t*.2}s`},children:"."},t))}),B=({name:t,Icon:a,props:i,componentType:n})=>e.jsxs("div",{className:"border rounded-lg bg-gray-50 dark:bg-gray-dark-800 mb-3",children:[e.jsxs("div",{className:"flex justify-between px-4 py-2 text-xs",children:[e.jsxs("div",{className:"font-medium flex items-center gap-2",children:[e.jsx(a,{className:"w-3 h-3 text-gray-600 dark:text-white-alpha-600"}),e.jsx("span",{children:t})]}),e.jsx("div",{className:"flex items-center px-1.5 py-0.5 rounded-md text-2xs uppercase tracking-wider bg-gray-200 dark:bg-white-alpha-200 font-medium text-gray-700 dark:text-white-alpha-700 font-mono",children:n})]}),e.jsx("div",{className:"px-4 py-2",children:e.jsx(K,{value:i})})]}),he=({name:t,props:a})=>e.jsx(B,{name:t,Icon:d.ComponentIcon,props:a,componentType:"component"}),fe=({name:t,props:a})=>e.jsx(B,{name:t,Icon:d.Library,props:a,componentType:"artifact"}),ge=({tool:t,componentDef:a,renderText:i,approvalId:n,messagePartsLength:x,setApprovalDelayPending:s,addToolApprovalResponse:u,sendMessage:c,conversationId:g})=>{const l=o.useRef(c);l.current=c;const m=o.useRef(u);m.current=u;const p=o.useRef(s);p.current=s;const h=o.useCallback(async(E=!0)=>{n&&(p.current({partCount:x}),m.current({id:n,approved:E}),await l.current(void 0,{body:{conversationId:g}}))},[n,x,g]),k=o.useMemo(()=>({tool:t,approve:h,renderMarkdown:i}),[t]),A=a?T.DynamicComponent:W;return e.jsx(A,{name:t.type,props:k,componentDef:a})};function F(t){return t===null?e.jsx("span",{className:"text-gray-500 dark:text-white-alpha-500 font-mono font-medium text-1xs",children:"null"}):t===void 0?e.jsx("span",{className:"text-gray-400 dark:text-white-alpha-400 italic text-xs font-medium",children:"undefined"}):typeof t=="boolean"?e.jsx("span",{className:b.cn("inline-flex font-mono font-semibold items-center px-1 py-0.5 text-1xs rounded-md border",t?"bg-inkeep-expanded-primary-50 border-inkeep-expanded-primary-200 text-inkeep-expanded-primary-600 dark:bg-inkeep-expanded-primary-950 dark:border-inkeep-expanded-primary-600 dark:text-inkeep-expanded-primary-200":"bg-gray-100 dark:bg-white-alpha-50 text-gray-700 dark:text-white-alpha-700"),children:t?"true":"false"}):typeof t=="number"?e.jsx("span",{className:"tabular-nums font-medium text-inkeep-expanded-primary-600 dark:text-inkeep-expanded-primary-200",children:t.toLocaleString()}):typeof t=="string"?e.jsx("span",{className:"text-gray-800 dark:text-white-alpha-800 break-words",children:t}):e.jsx("span",{children:String(t)})}const G=({name:t,value:a,isArrayIndex:i,depth:n=0})=>{const[x,s]=o.useState(n<1),u=a!==null&&typeof a=="object"&&!Array.isArray(a),c=Array.isArray(a);if(!(u||c))return e.jsxs("div",{className:"flex items-baseline gap-2 py-1 text-xs",children:[e.jsx("span",{className:b.cn("font-medium shrink-0",i?"text-gray-300 dark:text-white-alpha-300":"text-gray-500 dark:text-white-alpha-500"),children:i?"—":t}),e.jsx("span",{className:"min-w-0",children:F(a)})]});const l=c?a.map((p,h)=>[String(h),p]):Object.entries(a);return l.length===0?e.jsxs("div",{className:"flex items-baseline gap-2 py-1 text-xs",children:[e.jsx("span",{className:"font-medium text-gray-500 dark:text-white-alpha-500 shrink-0",children:t}),e.jsx("span",{className:"text-gray-400 dark:text-white-alpha-400 italic",children:c?"empty list":"empty"})]}):e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:p=>{p.stopPropagation(),s(!x)},className:"flex items-center gap-1.5 py-1 text-xs hover:bg-gray-50 dark:hover:bg-white-alpha-50 -mx-1.5 px-1.5 rounded transition-colors w-full text-left",children:[e.jsx(d.ChevronDown,{className:b.cn("h-3.5 w-3.5 text-gray-400 dark:text-white-alpha-400 shrink-0 transition-transform",!x&&"-rotate-90")}),e.jsx("span",{className:"font-medium text-gray-500 dark:text-white-alpha-500",children:t}),!x&&e.jsx("span",{className:"text-gray-400 dark:text-white-alpha-400 text-1xs ml-1",children:c?`${l.length} item${l.length!==1?"s":""}`:`${l.length} field${l.length!==1?"s":""}`})]}),x&&e.jsx("div",{className:"border-l-2 border-gray-200 dark:border-white-alpha-200 ml-1.5 pl-3",children:l.map(([p,h])=>e.jsx(G,{name:p,value:h,isArrayIndex:c,depth:n+1},p))})]})},K=({value:t})=>{if(t==null||typeof t!="object")return e.jsx("span",{className:"text-xs",children:F(t)});const a=Array.isArray(t)?t.map((i,n)=>[String(n),i]):Object.entries(t);return a.length===0?e.jsx("div",{className:"text-xs text-gray-400 dark:text-white-alpha-400 italic",children:"No arguments"}):e.jsx("div",{className:"space-y-1",children:a.map(([i,n])=>e.jsx(G,{name:i,value:n,isArrayIndex:Array.isArray(t)},i))})},W=({props:t})=>{const{tool:a,approve:i}=t,n=a.type,x=n.startsWith("tool-")?n.slice(5):n,s=a.state,u=a.approval?.id,c=!!u,g=s==="approval-requested",l=me(a.output),[m,p]=o.useState(c),h=s?pe[s]??s:"tool";o.useEffect(()=>{g&&p(!0)},[g]);const k=()=>{switch(s){case"input-streaming":return e.jsx(d.Circle,{className:"w-3 h-3"});case"input-available":return e.jsx(d.Loader2,{className:"w-3 h-3 animate-spin"});case"approval-requested":return e.jsx(d.Clock,{className:"w-3 h-3"});case"approval-responded":return e.jsx(d.CheckCircle,{className:"w-3 h-3"});case"output-available":return e.jsx(d.CheckCircle,{className:"w-3 h-3"});case"output-error":return e.jsx(d.TriangleAlert,{className:"w-3 h-3"});case"output-denied":return e.jsx(d.XCircle,{className:"w-3 h-3"});default:return null}};return e.jsxs("div",{className:"border rounded-lg mb-3 overflow-hidden",children:[e.jsxs("button",{type:"button",className:"inline-flex items-center group gap-2 text-xs text-gray-700 dark:text-white-alpha-700 hover:text-gray-800 dark:hover:text-white-alpha-800 transition-colors cursor-pointer w-full justify-between px-4 py-2 data-[expanded=true]:border-b",onClick:()=>p(!m),"aria-expanded":m,"data-expanded":m,children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"font-medium flex items-center gap-2",children:[e.jsx(d.Hammer,{className:"w-3 h-3 text-gray-600 dark:text-white-alpha-600"}),e.jsx("span",{children:x})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 py-0.5 rounded-md text-2xs uppercase tracking-wider bg-gray-100 dark:bg-white-alpha-100 font-medium text-gray-700 dark:text-white-alpha-700 font-mono",children:[k(),h]}),e.jsx(d.ChevronDown,{className:"w-3.5 h-3.5 text-gray-500 dark:text-white-alpha-500 transition-all duration-200 transform rotate-0 group-data-[expanded=true]:rotate-180"})]})]}),e.jsxs("div",{"data-expanded":m,className:b.cn("overflow-hidden transition-all duration-300 ease-in-out data-[expanded=true]:opacity-100 data-[expanded=false]:max-h-0 data-[expanded=false]:opacity-0 max-w-full"),children:[e.jsx("div",{"data-expanded":m,className:b.cn("relative",'before:content-[""] before:absolute before:inset-x-0 before:top-0 before:h-3 before:pointer-events-none before:z-10','after:content-[""] after:absolute after:inset-x-0 after:bottom-0 after:h-3 after:pointer-events-none after:z-10',"before:bg-[linear-gradient(white,_transparent)] after:bg-[linear-gradient(transparent,_white)]","dark:before:bg-[linear-gradient(var(--ikp-color-gray-dark-950),_transparent)] dark:after:bg-[linear-gradient(transparent,_var(--ikp-color-gray-dark-950))]","data-[expanded=false]:before:opacity-0 data-[expanded=false]:after:opacity-0"),children:e.jsx("div",{"data-expanded":m,className:b.cn("[scrollbar-width:thin] px-4","data-[expanded=true]:max-h-48 data-[expanded=true]:overflow-y-auto"),children:a.input!=null&&e.jsx("div",{className:"text-xs py-2",children:e.jsx(K,{value:a.input})})})}),g&&u&&e.jsxs("div",{className:"flex justify-end gap-2 pt-1 pb-3 px-4",children:[e.jsx("button",{type:"button",className:b.cn(V.button({size:"xs",variant:"outline"}),"px-2 py-1 rounded-md text-xs text-gray-700 dark:text-white-alpha-700"),onClick:()=>i(!1),children:"Deny"}),e.jsxs("button",{type:"button",className:b.cn(V.button({size:"xs",variant:"primaryFilled"}),"px-2 py-1 rounded-md text-xs gap-1"),onClick:()=>i(!0),children:[e.jsx(d.Check,{className:"w-3 h-3"}),"Approve"]})]}),s==="output-available"&&l&&a.output!=null&&e.jsxs("div",{className:"flex justify-end items-center gap-1 whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 capitalize pb-3 px-4",children:[l==="approved"&&e.jsx(d.Check,{className:"w-3 h-3"}),l]}),s==="output-denied"&&e.jsxs("div",{className:"flex justify-end items-center gap-1 whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 capitalize pb-3 px-4",children:[e.jsx(d.X,{className:"w-3 h-3"}),h]})]})]})},ye=({className:t,componentStyles:a,children:i,isLast:n,...x})=>{const{message:s}=se.useMessage(),{logEvent:u}=ae.useBaseEvents(),{conversationId:c,isStreaming:g,isLoading:l,setError:m,addToolApprovalResponse:p,sendMessage:h}=ne.useChat(),{aiChatSettings:{components:k,artifacts:A,headers:E}}=re.useInkeepConfig(),X=E?.["x-emit-operations"]==="true",$=s.role==="user",q=(g||l)&&n&&s.role==="assistant",{processedParts:H,summaryTimings:J,shouldShowInitialLoading:Q,shouldShowStreamDelayLoading:Y}=de.useStreamProcessor(s.parts,q,m),[S,_]=o.useState(null),[Z,M]=o.useState(!1),y=o.useRef(null);o.useEffect(()=>{if(!S){M(!1),y.current&&(clearTimeout(y.current),y.current=null);return}return M(!1),y.current&&clearTimeout(y.current),y.current=window.setTimeout(()=>{M(!0)},1e3),()=>{y.current&&(clearTimeout(y.current),y.current=null)}},[S]),o.useEffect(()=>{S&&(!n||s.parts.length>S.partCount||!q)&&_(null)},[S,n,s.parts.length,q]);const I=o.useMemo(()=>s.parts.filter(oe.isCitationArtifact),[s.parts]),O=o.useMemo(()=>ie.merge(le.markdownStyles,a??{}),[a]),z=o.useCallback((r,f)=>{u({eventName:"assistant_message_inline_link_opened",properties:{title:f?.toString(),url:r}})},[u]),U=o.useCallback((r,f)=>{u({eventName:"assistant_code_block_copied",properties:{conversationId:c,language:r,code:f}})},[u,c]),R=o.useCallback(r=>e.jsx(C.EmbeddedChatPrimitiveMarkdown,{text:r,componentStyles:O,onLinkClick:z,onCodeCopy:U,artifacts:I}),[O,z,U,I]),ee=o.useMemo(()=>b.cn("data-[role=user]:whitespace-pre-wrap mb-3 data-[role=user]:mb-0 [&[data-role=user]>p]:mb-0 max-w-full",t),[t]),te=!$||s.parts.some(r=>r.type==="text"&&r.text?.trim());return e.jsxs(e.Fragment,{children:[!te&&e.jsx("span",{className:"text-gray-500 dark:text-white-alpha-500",children:"No message content"}),H.map((r,f)=>{const v={"data-role":s.role,"data-type":r?.type==="data-component"?r.data.type:r?.type,...x,className:ee};switch(r?.type){case"text":return e.jsx(C.PrimitiveMessagePart,{...v,children:$?r.text:R(r.text||"")},f);case"data-component":{const{type:w}=r.data;switch(w){case"text":return e.jsx("div",{...v,children:R(r.data.text||"")},f);default:{const N=r.data,{name:j,props:D}=N,P=k?.[j],L=P?T.DynamicComponent:he;return e.jsx(C.PrimitiveMessagePart,{...v,children:e.jsx(L,{name:j,props:D,componentDef:P})},`${j}-${f}`)}}}case"data-artifact":{const w=r.data,{name:N,type:j,artifactSummary:D}=w;if(j==="citation"&&!D?.url)return null;const P=A?.[j],L=P?T.DynamicComponent:fe;return e.jsx(C.PrimitiveMessagePart,{...v,children:e.jsx(L,{name:j,props:D,componentDef:P})},`${N}-${f}`)}case"summary-group":{const w=J.get(r.groupKey)||{isCompleted:!1};return e.jsx(C.PrimitiveMessagePart,{...v,children:e.jsx(ce.DataSummaryGroup,{summaries:r.summaries||[],isCompleted:w.isCompleted})},`${r.groupKey}-${f}`)}default:{if(!ue(r))return null;const w=r,N=r.approval?.id;return X||N?e.jsx(C.PrimitiveMessagePart,{...v,children:e.jsx(ge,{tool:w,componentDef:k?.IkpTool,renderText:R,approvalId:N,messagePartsLength:s.parts.length,setApprovalDelayPending:_,addToolApprovalResponse:p,sendMessage:h,conversationId:c})},r.toolCallId??`${r.type}-${f}`):null}}}),Q&&e.jsx(T.MessageLoading,{}),(Y||Z)&&e.jsx(xe,{})]})};exports.DefaultToolComponent=W;exports.EmbeddedChatMessagePart=ye;
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),ae=require("../../primitives/providers/base-events-provider.cjs"),re=require("../../primitives/providers/config-provider.cjs"),se=require("../../primitives/providers/message-provider.cjs"),C=require("../../primitives/components/embedded-chat.cjs"),ne=require("../../primitives/components/embedded-chat/chat-provider.cjs"),oe=require("../../primitives/utils/misc.cjs"),ie=require("merge-anything"),b=require("../utils.cjs"),le=require("./ui/markdown-styles.cjs"),de=require("../../primitives/components/embedded-chat/use-stream-processor.cjs"),ce=require("./data-summary-group.cjs"),o=require("react"),T=require("./embedded-chat.cjs"),c=require("lucide-react"),V=require("./ui/recipes/button.cjs"),pe={"input-streaming":"Pending","input-available":"Running","approval-requested":"Awaiting Approval","approval-responded":"Responded","output-available":"Completed","output-error":"Error","output-denied":"Denied"};function ue(t){if(!t||typeof t!="object")return!1;const a=t;return typeof a.type=="string"&&a.type.startsWith("tool-")}const me=t=>{if(!t||typeof t!="object"||!("status"in t))return;const a=t.status;return typeof a=="string"?a:void 0},xe=()=>e.jsx("div",{className:"flex space-x-1",children:[0,1,2].map(t=>e.jsx("span",{className:"animate-bounce-dot opacity-30",style:{animationDelay:`${t*.2}s`},children:"."},t))}),B=({name:t,Icon:a,props:l,componentType:n})=>e.jsxs("div",{className:"border rounded-lg bg-gray-50 dark:bg-gray-dark-800 mb-3",children:[e.jsxs("div",{className:"flex justify-between px-4 py-2 text-xs",children:[e.jsxs("div",{className:"font-medium flex items-center gap-2",children:[e.jsx(a,{className:"w-3 h-3 text-gray-600 dark:text-white-alpha-600"}),e.jsx("span",{children:t})]}),e.jsx("div",{className:"flex items-center px-1.5 py-0.5 rounded-md text-2xs uppercase tracking-wider bg-gray-200 dark:bg-white-alpha-200 font-medium text-gray-700 dark:text-white-alpha-700 font-mono",children:n})]}),e.jsx("div",{className:"px-4 py-2",children:e.jsx(K,{value:l})})]}),he=({name:t,props:a})=>e.jsx(B,{name:t,Icon:c.ComponentIcon,props:a,componentType:"component"}),fe=({name:t,props:a})=>e.jsx(B,{name:t,Icon:c.Library,props:a,componentType:"artifact"}),ge=({tool:t,componentDef:a,renderText:l,approvalId:n,messagePartsLength:x,setApprovalDelayPending:r,addToolApprovalResponse:u,sendMessage:i,conversationId:g})=>{const d=o.useRef(i);d.current=i;const m=o.useRef(u);m.current=u;const p=o.useRef(r);p.current=r;const h=o.useCallback(async(E=!0)=>{n&&(p.current({partCount:x}),m.current({id:n,approved:E}),await d.current(void 0,{body:{conversationId:g}}))},[n,x,g]),k=o.useMemo(()=>({tool:t,approve:h,renderMarkdown:l}),[t]),A=a?T.DynamicComponent:W;return e.jsx(A,{name:t.type,props:k,componentDef:a})};function F(t){return t===null?e.jsx("span",{className:"text-gray-500 dark:text-white-alpha-500 font-mono font-medium text-1xs",children:"null"}):t===void 0?e.jsx("span",{className:"text-gray-400 dark:text-white-alpha-400 italic text-xs font-medium",children:"undefined"}):typeof t=="boolean"?e.jsx("span",{className:b.cn("inline-flex font-mono font-semibold items-center px-1 py-0.5 text-1xs rounded-md border",t?"bg-inkeep-expanded-primary-50 border-inkeep-expanded-primary-200 text-inkeep-expanded-primary-600 dark:bg-inkeep-expanded-primary-950 dark:border-inkeep-expanded-primary-600 dark:text-inkeep-expanded-primary-200":"bg-gray-100 dark:bg-white-alpha-50 text-gray-700 dark:text-white-alpha-700"),children:t?"true":"false"}):typeof t=="number"?e.jsx("span",{className:"tabular-nums font-medium text-inkeep-expanded-primary-600 dark:text-inkeep-expanded-primary-200",children:String(t)}):typeof t=="string"?e.jsx("span",{className:"text-gray-800 dark:text-white-alpha-800 break-words",children:t}):e.jsx("span",{children:String(t)})}const G=({name:t,value:a,isArrayIndex:l,depth:n=0})=>{const[x,r]=o.useState(n<1),u=a!==null&&typeof a=="object"&&!Array.isArray(a),i=Array.isArray(a);if(!(u||i))return e.jsxs("div",{className:"flex items-baseline gap-2 py-1 text-xs",children:[e.jsx("span",{className:b.cn("font-medium shrink-0",l?"text-gray-300 dark:text-white-alpha-300":"text-gray-500 dark:text-white-alpha-500"),children:l?"—":t}),e.jsx("span",{className:"min-w-0",children:F(a)})]});const d=i?a.map((p,h)=>[String(h),p]):Object.entries(a);return d.length===0?e.jsxs("div",{className:"flex items-baseline gap-2 py-1 text-xs",children:[e.jsx("span",{className:"font-medium text-gray-500 dark:text-white-alpha-500 shrink-0",children:t}),e.jsx("span",{className:"text-gray-400 dark:text-white-alpha-400 italic",children:i?"empty list":"empty"})]}):e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:p=>{p.stopPropagation(),r(!x)},className:"flex items-center gap-1.5 py-1 text-xs hover:bg-gray-50 dark:hover:bg-white-alpha-50 -mx-1.5 px-1.5 rounded transition-colors w-full text-left",children:[e.jsx(c.ChevronDown,{className:b.cn("h-3.5 w-3.5 text-gray-400 dark:text-white-alpha-400 shrink-0 transition-transform",!x&&"-rotate-90")}),e.jsx("span",{className:"font-medium text-gray-500 dark:text-white-alpha-500",children:t}),!x&&e.jsx("span",{className:"text-gray-400 dark:text-white-alpha-400 text-1xs ml-1",children:i?`${d.length} item${d.length!==1?"s":""}`:`${d.length} field${d.length!==1?"s":""}`})]}),x&&e.jsx("div",{className:"border-l-2 border-gray-200 dark:border-white-alpha-200 ml-1.5 pl-3",children:d.map(([p,h])=>e.jsx(G,{name:p,value:h,isArrayIndex:i,depth:n+1},p))})]})},K=({value:t})=>{if(t==null||typeof t!="object")return e.jsx("span",{className:"text-xs",children:F(t)});const a=Array.isArray(t)?t.map((l,n)=>[String(n),l]):Object.entries(t);return a.length===0?e.jsx("div",{className:"text-xs text-gray-400 dark:text-white-alpha-400 italic",children:"No arguments"}):e.jsx("div",{className:"space-y-1",children:a.map(([l,n])=>e.jsx(G,{name:l,value:n,isArrayIndex:Array.isArray(t)},l))})},W=({props:t})=>{const{tool:a,approve:l}=t,n=a.type,x=n.startsWith("tool-")?n.slice(5):n,r=a.state,u=a.approval?.id,i=!!u,g=r==="approval-requested",d=me(a.output),[m,p]=o.useState(i),h=r?pe[r]??r:"tool";o.useEffect(()=>{g&&p(!0)},[g]);const k=()=>{switch(r){case"input-streaming":return e.jsx(c.Circle,{className:"w-3 h-3"});case"input-available":return e.jsx(c.Loader2,{className:"w-3 h-3 animate-spin"});case"approval-requested":return e.jsx(c.Clock,{className:"w-3 h-3"});case"approval-responded":return e.jsx(c.CheckCircle,{className:"w-3 h-3"});case"output-available":return e.jsx(c.CheckCircle,{className:"w-3 h-3"});case"output-error":return e.jsx(c.TriangleAlert,{className:"w-3 h-3"});case"output-denied":return e.jsx(c.XCircle,{className:"w-3 h-3"});default:return null}};return e.jsxs("div",{className:"border rounded-lg mb-3 overflow-hidden",children:[e.jsxs("button",{type:"button",className:"inline-flex items-center group gap-2 text-xs text-gray-700 dark:text-white-alpha-700 hover:text-gray-800 dark:hover:text-white-alpha-800 transition-colors cursor-pointer w-full justify-between px-4 py-2 data-[expanded=true]:border-b",onClick:()=>p(!m),"aria-expanded":m,"data-expanded":m,children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"font-medium flex items-center gap-2",children:[e.jsx(c.Hammer,{className:"w-3 h-3 text-gray-600 dark:text-white-alpha-600"}),e.jsx("span",{children:x})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 py-0.5 rounded-md text-2xs uppercase tracking-wider bg-gray-100 dark:bg-white-alpha-100 font-medium text-gray-700 dark:text-white-alpha-700 font-mono",children:[k(),h]}),e.jsx(c.ChevronDown,{className:"w-3.5 h-3.5 text-gray-500 dark:text-white-alpha-500 transition-all duration-200 transform rotate-0 group-data-[expanded=true]:rotate-180"})]})]}),e.jsxs("div",{"data-expanded":m,className:b.cn("overflow-hidden transition-all duration-300 ease-in-out data-[expanded=true]:opacity-100 data-[expanded=false]:max-h-0 data-[expanded=false]:opacity-0 max-w-full"),children:[e.jsx("div",{"data-expanded":m,className:b.cn("relative",'before:content-[""] before:absolute before:inset-x-0 before:top-0 before:h-3 before:pointer-events-none before:z-10','after:content-[""] after:absolute after:inset-x-0 after:bottom-0 after:h-3 after:pointer-events-none after:z-10',"before:bg-[linear-gradient(white,_transparent)] after:bg-[linear-gradient(transparent,_white)]","dark:before:bg-[linear-gradient(var(--ikp-color-gray-dark-950),_transparent)] dark:after:bg-[linear-gradient(transparent,_var(--ikp-color-gray-dark-950))]","data-[expanded=false]:before:opacity-0 data-[expanded=false]:after:opacity-0"),children:e.jsx("div",{"data-expanded":m,className:b.cn("[scrollbar-width:thin] px-4","data-[expanded=true]:max-h-48 data-[expanded=true]:overflow-y-auto"),children:a.input!=null&&e.jsx("div",{className:"text-xs py-2",children:e.jsx(K,{value:a.input})})})}),g&&u&&e.jsxs("div",{className:"flex justify-end gap-2 pt-1 pb-3 px-4",children:[e.jsx("button",{type:"button",className:b.cn(V.button({size:"xs",variant:"outline"}),"px-2 py-1 rounded-md text-xs text-gray-700 dark:text-white-alpha-700"),onClick:()=>l(!1),children:"Deny"}),e.jsxs("button",{type:"button",className:b.cn(V.button({size:"xs",variant:"primaryFilled"}),"px-2 py-1 rounded-md text-xs gap-1"),onClick:()=>l(!0),children:[e.jsx(c.Check,{className:"w-3 h-3"}),"Approve"]})]}),r==="output-available"&&d&&a.output!=null&&e.jsxs("div",{className:"flex justify-end items-center gap-1 whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 capitalize pb-3 px-4",children:[d==="approved"&&e.jsx(c.Check,{className:"w-3 h-3"}),d]}),r==="output-denied"&&e.jsxs("div",{className:"flex justify-end items-center gap-1 whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 capitalize pb-3 px-4",children:[e.jsx(c.X,{className:"w-3 h-3"}),h]})]})]})},ye=({className:t,componentStyles:a,children:l,isLast:n,...x})=>{const{message:r}=se.useMessage(),{logEvent:u}=ae.useBaseEvents(),{conversationId:i,isStreaming:g,isLoading:d,setError:m,addToolApprovalResponse:p,sendMessage:h}=ne.useChat(),{aiChatSettings:{components:k,artifacts:A,headers:E}}=re.useInkeepConfig(),X=E?.["x-emit-operations"]==="true",$=r.role==="user",q=(g||d)&&n&&r.role==="assistant",{processedParts:H,summaryTimings:J,shouldShowInitialLoading:Q,shouldShowStreamDelayLoading:Y}=de.useStreamProcessor(r.parts,q,m),[S,L]=o.useState(null),[Z,M]=o.useState(!1),y=o.useRef(null);o.useEffect(()=>{if(!S){M(!1),y.current&&(clearTimeout(y.current),y.current=null);return}return M(!1),y.current&&clearTimeout(y.current),y.current=window.setTimeout(()=>{M(!0)},1e3),()=>{y.current&&(clearTimeout(y.current),y.current=null)}},[S]),o.useEffect(()=>{S&&(!n||r.parts.length>S.partCount||!q)&&L(null)},[S,n,r.parts.length,q]);const _=o.useMemo(()=>r.parts.filter(oe.isCitationArtifact),[r.parts]),O=o.useMemo(()=>ie.merge(le.markdownStyles,a??{}),[a]),z=o.useCallback((s,f)=>{u({eventName:"assistant_message_inline_link_opened",properties:{conversationId:i,messageId:r.id,title:f?.toString(),url:s}})},[u,i,r.id]),U=o.useCallback((s,f)=>{u({eventName:"assistant_code_block_copied",properties:{conversationId:i,messageId:r.id,language:s,code:f}})},[u,i,r.id]),R=o.useCallback(s=>e.jsx(C.EmbeddedChatPrimitiveMarkdown,{text:s,componentStyles:O,onLinkClick:z,onCodeCopy:U,artifacts:_}),[O,z,U,_]),ee=o.useMemo(()=>b.cn("data-[role=user]:whitespace-pre-wrap mb-3 data-[role=user]:mb-0 [&[data-role=user]>p]:mb-0 max-w-full",t),[t]),te=!$||r.parts.some(s=>s.type==="text"&&s.text?.trim());return e.jsxs(e.Fragment,{children:[!te&&e.jsx("span",{className:"text-gray-500 dark:text-white-alpha-500",children:"No message content"}),H.map((s,f)=>{const v={"data-role":r.role,"data-type":s?.type==="data-component"?s.data.type:s?.type,...x,className:ee};switch(s?.type){case"text":return e.jsx(C.PrimitiveMessagePart,{...v,children:$?s.text:R(s.text||"")},f);case"data-component":{const{type:w}=s.data;switch(w){case"text":return e.jsx("div",{...v,children:R(s.data.text||"")},f);default:{const N=s.data,{name:j,props:D}=N,P=k?.[j],I=P?T.DynamicComponent:he;return e.jsx(C.PrimitiveMessagePart,{...v,children:e.jsx(I,{name:j,props:D,componentDef:P})},`${j}-${f}`)}}}case"data-artifact":{const w=s.data,{name:N,type:j,artifactSummary:D}=w;if(j==="citation"&&!D?.url)return null;const P=A?.[j],I=P?T.DynamicComponent:fe;return e.jsx(C.PrimitiveMessagePart,{...v,children:e.jsx(I,{name:j,props:D,componentDef:P})},`${N}-${f}`)}case"summary-group":{const w=J.get(s.groupKey)||{isCompleted:!1};return e.jsx(C.PrimitiveMessagePart,{...v,children:e.jsx(ce.DataSummaryGroup,{summaries:s.summaries||[],isCompleted:w.isCompleted})},`${s.groupKey}-${f}`)}default:{if(!ue(s))return null;const w=s,N=s.approval?.id;return X||N?e.jsx(C.PrimitiveMessagePart,{...v,children:e.jsx(ge,{tool:w,componentDef:k?.IkpTool,renderText:R,approvalId:N,messagePartsLength:r.parts.length,setApprovalDelayPending:L,addToolApprovalResponse:p,sendMessage:h,conversationId:i})},s.toolCallId??`${s.type}-${f}`):null}}}),Q&&e.jsx(T.MessageLoading,{}),(Y||Z)&&e.jsx(xe,{})]})};exports.DefaultToolComponent=W;exports.EmbeddedChatMessagePart=ye;
|