@inkeep/agents-ui 0.0.0-dev-20260508213807 → 0.0.0-dev-20260508233535

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 (38) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +156 -153
  3. package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +2 -2
  4. package/dist/primitives/components/embedded-chat/use-inkeep-chat.d.ts +0 -13
  5. package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +224 -238
  6. package/dist/primitives/components/embedded-chat.d.ts +1 -1
  7. package/dist/primitives/index.cjs +1 -1
  8. package/dist/primitives/index.js +144 -141
  9. package/dist/primitives/providers/chat-auth-provider.cjs +1 -0
  10. package/dist/primitives/providers/chat-auth-provider.d.ts +15 -0
  11. package/dist/primitives/providers/chat-auth-provider.js +44 -0
  12. package/dist/primitives/providers/index.cjs +1 -1
  13. package/dist/primitives/providers/index.d.ts +1 -0
  14. package/dist/primitives/providers/index.js +51 -48
  15. package/dist/react/embedded-chat.cjs +1 -1
  16. package/dist/react/embedded-chat.js +75 -74
  17. package/dist/react/index.cjs +1 -1
  18. package/dist/react/index.js +156 -153
  19. package/dist/styled/components/message.cjs +1 -1
  20. package/dist/styled/components/message.js +210 -272
  21. package/dist/styled/index.cjs +1 -1
  22. package/dist/styled/index.js +148 -145
  23. package/dist/styled/inkeep.css.cjs +0 -78
  24. package/dist/styled/inkeep.css.js +0 -78
  25. package/package.json +1 -2
  26. package/dist/node_modules/.pnpm/@hookform_resolvers@5.2.2_react-hook-form@7.70.0_react@19.3.0-canary-87ae75b3-20260128_/node_modules/@hookform/resolvers/zod/dist/zod.cjs +0 -1
  27. package/dist/node_modules/.pnpm/@hookform_resolvers@5.2.2_react-hook-form@7.70.0_react@19.3.0-canary-87ae75b3-20260128_/node_modules/@hookform/resolvers/zod/dist/zod.js +0 -93
  28. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.cjs +0 -1
  29. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js +0 -49
  30. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.cjs +0 -1
  31. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js +0 -19
  32. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.cjs +0 -1
  33. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js +0 -28
  34. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.cjs +0 -1
  35. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.js +0 -23
  36. package/dist/styled/components/ask-user-form.cjs +0 -1
  37. package/dist/styled/components/ask-user-form.d.ts +0 -96
  38. package/dist/styled/components/ask-user-form.js +0 -672
@@ -1,7 +1,7 @@
1
1
  import { InkeepEmbeddedChat as S, InkeepEmbeddedChatImpl as c, InkeepEmbeddedChatImplContent as P, InkeepEmbeddedChatProvider as v } from "./embedded-chat.js";
2
2
  import { InkeepSidebarChat as M } 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 D } from "./embedded-search.js";
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";
@@ -23,87 +23,89 @@ import { widgetToggle as oe } from "../styled/components/ui/recipes/widget-toggl
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
25
  import { BaseEventsProvider as se, useBaseEvents as ie } from "../primitives/providers/base-events-provider.js";
26
- import { ChatFormProvider as Ce, useChatForm as fe, useChatFormState as he } from "../primitives/providers/chat-form-provider.js";
27
- import { ChatHistoryProvider as ue, useChatHistory as le } from "../primitives/providers/chat-history-provider.js";
28
- import { InkeepConfigProvider as be, WebWidgetInteractionType as Se, useInkeepConfig as ce } from "../primitives/providers/config-provider.js";
29
- import { FeedbackProvider as ve, useMessageFeedback as ke } from "../primitives/providers/feedback-provider.js";
30
- import { FormFieldProvider as Be, useFormField as ge } from "../primitives/providers/form-field-provider.js";
31
- import { HelpMenuProvider as ye, useHelpMenu as Fe, useHelpMenuState as He } from "../primitives/providers/help-menu-provider.js";
32
- import { ChatMarkdownProvider as De, useChatMarkdown as Ae } from "../primitives/providers/markdown-provider.js";
33
- import { MessageProvider as $e, useMessage as Te, useOptionalMessage as Oe } from "../primitives/providers/message-provider.js";
34
- import { RootProvider as ze } from "../primitives/providers/root-provider.js";
35
- import { SourceItemProvider as je, useSourceItem as Ge } from "../primitives/providers/source-item-provider.js";
36
- import { ThemeProvider as Ne } from "../primitives/providers/theme-provider.js";
37
- import { WidgetProvider as Ue, useWidget as Ve } from "../primitives/providers/widget-provider.js";
38
- import { SidebarChatProvider as Je, useInkeepSidebarChat as Xe, useOptionalSidebarChat as Ye, useSidebarChat as Ze } from "../primitives/providers/sidebar-chat-provider.js";
39
- import { ChatBubbleProvider as eo, useChatBubble as oo, useInkeepChatBubble as ro, useOptionalChatBubble as to } from "../primitives/providers/chat-bubble-provider.js";
40
- import { ikp as mo, jsxFactory as po } from "../primitives/components/factory.js";
26
+ import { ChatAuthProvider as Ce, useChatAuth as he } from "../primitives/providers/chat-auth-provider.js";
27
+ import { ChatFormProvider as xe, useChatForm as ue, useChatFormState as le } from "../primitives/providers/chat-form-provider.js";
28
+ import { ChatHistoryProvider as be, useChatHistory as Se } from "../primitives/providers/chat-history-provider.js";
29
+ import { InkeepConfigProvider as Pe, WebWidgetInteractionType as ve, useInkeepConfig as ke } from "../primitives/providers/config-provider.js";
30
+ import { FeedbackProvider as Be, useMessageFeedback as ge } from "../primitives/providers/feedback-provider.js";
31
+ import { FormFieldProvider as ye, useFormField as Fe } from "../primitives/providers/form-field-provider.js";
32
+ import { HelpMenuProvider as we, useHelpMenu as Ae, useHelpMenuState as De } from "../primitives/providers/help-menu-provider.js";
33
+ import { ChatMarkdownProvider as $e, useChatMarkdown as Te } from "../primitives/providers/markdown-provider.js";
34
+ import { MessageProvider as We, useMessage as ze, useOptionalMessage as Le } from "../primitives/providers/message-provider.js";
35
+ import { RootProvider as Ge } from "../primitives/providers/root-provider.js";
36
+ import { SourceItemProvider as Ne, useSourceItem as Qe } from "../primitives/providers/source-item-provider.js";
37
+ import { ThemeProvider as Ve } from "../primitives/providers/theme-provider.js";
38
+ import { WidgetProvider as Je, useWidget as Xe } from "../primitives/providers/widget-provider.js";
39
+ import { SidebarChatProvider as Ze, useInkeepSidebarChat as _e, useOptionalSidebarChat as eo, useSidebarChat as oo } from "../primitives/providers/sidebar-chat-provider.js";
40
+ import { ChatBubbleProvider as to, useChatBubble as ao, useInkeepChatBubble as mo, useOptionalChatBubble as po } from "../primitives/providers/chat-bubble-provider.js";
41
+ import { ikp as io, jsxFactory as no } from "../primitives/components/factory.js";
41
42
  import * as s from "../primitives/components/embedded-chat.js";
42
43
  import * as i from "../primitives/components/sidebar-chat/index.js";
43
- import { ChatProvider as io, useChat as no } from "../primitives/components/embedded-chat/chat-provider.js";
44
+ import { ChatProvider as ho, useChat as fo } from "../primitives/components/embedded-chat/chat-provider.js";
44
45
  import * as n from "../primitives/components/embedded-search.js";
45
- import { SearchProvider as fo, SearchProviderImpl as ho, useSearch as xo } from "../primitives/components/embedded-search/search-provider.js";
46
+ import { SearchProvider as uo, SearchProviderImpl as lo, useSearch as Io } from "../primitives/components/embedded-search/search-provider.js";
46
47
  import * as C from "../primitives/components/modal.js";
47
- import { ModalProvider as lo, useModal as Io } from "../primitives/components/modal/modal-provider.js";
48
- import * as f from "../primitives/components/chat-button.js";
49
- import * as h from "../primitives/components/searchbar.js";
48
+ import { ModalProvider as So, useModal as co } from "../primitives/components/modal/modal-provider.js";
49
+ import * as h from "../primitives/components/chat-button.js";
50
+ import * as f from "../primitives/components/searchbar.js";
50
51
  import * as x from "../primitives/components/chat-bubble/index.js";
51
52
  import * as u from "../primitives/components/data-summaries.js";
52
53
  import * as l from "../primitives/components/chat-history/index.js";
53
- import { useBoolean as So } from "../primitives/hooks/use-boolean.js";
54
- import { useComponentClassNames as Po } from "../primitives/hooks/use-component-classnames.js";
55
- import { useContainerSize as ko } from "../primitives/hooks/use-container-size.js";
56
- import { useInkeepOpenState as Bo } from "../primitives/hooks/use-inkeep-open-state.js";
57
- import { useCopyToClipboard as Eo } from "../primitives/hooks/use-copy-to-clipboard.js";
58
- import { useInstantUpdate as Fo } from "../primitives/hooks/use-instant-update.js";
59
- import { useIsMounted as wo } from "../primitives/hooks/use-is-mounted.js";
60
- import { useMediaQuery as Ao } from "../primitives/hooks/use-media-query.js";
61
- import { useResizeObserver as $o } from "../primitives/hooks/use-resize-observer.js";
62
- import { useScrollingFades as Oo, useScrollingFadesHorizontal as Wo } from "../primitives/hooks/use-scrolling-fades.js";
63
- import { useSettleAction as Lo } from "../primitives/hooks/use-settle-action.js";
64
- import { useSimpleScroll as Go } from "../primitives/hooks/use-simple-scroll.js";
65
- import { callAll as No, dataAttr as Qo, getInitials as Uo, getMessageContent as Vo, isCitationArtifact as qo, isString as Jo, maybeRender as Xo, toKebabCase as Yo } from "../primitives/utils/misc.js";
66
- import { ChatBubbleComponentIds as _o, DataSummaryComponentIds as er, SearchBarComponentIds as or, SidebarChatComponentIds as rr, aiChatComponentIds as tr, aiChatHistoryComponentIds as ar, aiSearchComponentIds as mr, chatButtonComponentIds as dr, componentIDs as pr, markDownComponentIds as sr, miscellanousComponentIds as ir, modalComponentIds as nr } from "../primitives/utils/component-ids.js";
67
- import { composeRefs as fr, useComposedRefs as hr } from "../primitives/utils/compose-refs.js";
68
- import { mergeProps as ur } from "../primitives/utils/merge-props.js";
69
- import { Portal as Ir } from "../primitives/atoms/portal.js";
70
- import { CustomIcon as Sr } from "../primitives/atoms/icons/custom-icon.js";
71
- import { BuiltInIconRenderer as Pr } from "../primitives/atoms/icons/built-in-icon-renderer.js";
72
- import { PortalWithTheme as kr } from "../primitives/atoms/portal-with-theme.js";
73
- import { Command as Br, CommandDialog as gr, CommandEmpty as Er, CommandInput as yr, CommandItem as Fr, CommandList as Hr, CommandLoading as wr, CommandRoot as Dr, CommandSeparator as Ar, defaultFilter as Rr, useCommandState as $r, useCommandStore as Tr } from "../primitives/atoms/cmdk/index.js";
74
- import { ErrorBoundary as Wr } from "../primitives/atoms/error-boundary.js";
75
- import { ColorMode as Lr, ColorModeProvider as jr, DarkModeProvider as Gr, useColorMode as Kr, useColorModeValue as Nr } from "../color-mode/index.js";
76
- import { InkeepShadow as Ur, InkeepShadowProvider as Vr, ShadowContext as qr, useShadow as Jr } from "../primitives/atoms/shadow/context.js";
54
+ import { useBoolean as vo } from "../primitives/hooks/use-boolean.js";
55
+ import { useComponentClassNames as Mo } from "../primitives/hooks/use-component-classnames.js";
56
+ import { useContainerSize as go } from "../primitives/hooks/use-container-size.js";
57
+ import { useInkeepOpenState as yo } from "../primitives/hooks/use-inkeep-open-state.js";
58
+ import { useCopyToClipboard as Ho } from "../primitives/hooks/use-copy-to-clipboard.js";
59
+ import { useInstantUpdate as Ao } from "../primitives/hooks/use-instant-update.js";
60
+ import { useIsMounted as Ro } from "../primitives/hooks/use-is-mounted.js";
61
+ import { useMediaQuery as To } from "../primitives/hooks/use-media-query.js";
62
+ import { useResizeObserver as Wo } from "../primitives/hooks/use-resize-observer.js";
63
+ import { useScrollingFades as Lo, useScrollingFadesHorizontal as jo } from "../primitives/hooks/use-scrolling-fades.js";
64
+ import { useSettleAction as Ko } from "../primitives/hooks/use-settle-action.js";
65
+ import { useSimpleScroll as Qo } from "../primitives/hooks/use-simple-scroll.js";
66
+ import { callAll as Vo, dataAttr as qo, getInitials as Jo, getMessageContent as Xo, isCitationArtifact as Yo, isString as Zo, maybeRender as _o, toKebabCase as er } from "../primitives/utils/misc.js";
67
+ import { ChatBubbleComponentIds as rr, DataSummaryComponentIds as tr, SearchBarComponentIds as ar, SidebarChatComponentIds as mr, aiChatComponentIds as dr, aiChatHistoryComponentIds as pr, aiSearchComponentIds as sr, chatButtonComponentIds as ir, componentIDs as nr, markDownComponentIds as Cr, miscellanousComponentIds as hr, modalComponentIds as fr } from "../primitives/utils/component-ids.js";
68
+ import { composeRefs as ur, useComposedRefs as lr } from "../primitives/utils/compose-refs.js";
69
+ import { mergeProps as br } from "../primitives/utils/merge-props.js";
70
+ import { Portal as cr } from "../primitives/atoms/portal.js";
71
+ import { CustomIcon as vr } from "../primitives/atoms/icons/custom-icon.js";
72
+ import { BuiltInIconRenderer as Mr } from "../primitives/atoms/icons/built-in-icon-renderer.js";
73
+ import { PortalWithTheme as gr } from "../primitives/atoms/portal-with-theme.js";
74
+ import { Command as yr, CommandDialog as Fr, CommandEmpty as Hr, CommandInput as wr, CommandItem as Ar, CommandList as Dr, CommandLoading as Rr, CommandRoot as $r, CommandSeparator as Tr, defaultFilter as Or, useCommandState as Wr, useCommandStore as zr } from "../primitives/atoms/cmdk/index.js";
75
+ import { ErrorBoundary as jr } from "../primitives/atoms/error-boundary.js";
76
+ import { ColorMode as Kr, ColorModeProvider as Nr, DarkModeProvider as Qr, useColorMode as Ur, useColorModeValue as Vr } from "../color-mode/index.js";
77
+ import { InkeepShadow as Jr, InkeepShadowProvider as Xr, ShadowContext as Yr, useShadow as Zr } from "../primitives/atoms/shadow/context.js";
77
78
  export {
78
79
  se as BaseEventsProvider,
79
- Pr as BuiltInIconRenderer,
80
+ Mr as BuiltInIconRenderer,
81
+ Ce as ChatAuthProvider,
80
82
  t as ChatBubble,
81
- _o as ChatBubbleComponentIds,
83
+ rr as ChatBubbleComponentIds,
82
84
  x as ChatBubblePrimitive,
83
- eo as ChatBubbleProvider,
85
+ to as ChatBubbleProvider,
84
86
  d as ChatButton,
85
87
  K as ChatButtonImpl,
86
- f as ChatButtonPrimitive,
87
- Ce as ChatFormProvider,
88
+ h as ChatButtonPrimitive,
89
+ xe as ChatFormProvider,
88
90
  o as ChatHistory,
89
91
  l as ChatHistoryPrimitive,
90
- ue as ChatHistoryProvider,
91
- De as ChatMarkdownProvider,
92
- io as ChatProvider,
93
- Lr as ColorMode,
94
- jr as ColorModeProvider,
95
- Br as Command,
96
- gr as CommandDialog,
97
- Er as CommandEmpty,
98
- yr as CommandInput,
99
- Fr as CommandItem,
100
- Hr as CommandList,
101
- wr as CommandLoading,
102
- Dr as CommandRoot,
103
- Ar as CommandSeparator,
104
- Sr as CustomIcon,
105
- Gr as DarkModeProvider,
106
- er as DataSummaryComponentIds,
92
+ be as ChatHistoryProvider,
93
+ $e as ChatMarkdownProvider,
94
+ ho as ChatProvider,
95
+ Kr as ColorMode,
96
+ Nr as ColorModeProvider,
97
+ yr as Command,
98
+ Fr as CommandDialog,
99
+ Hr as CommandEmpty,
100
+ wr as CommandInput,
101
+ Ar as CommandItem,
102
+ Dr as CommandList,
103
+ Rr as CommandLoading,
104
+ $r as CommandRoot,
105
+ Tr as CommandSeparator,
106
+ vr as CustomIcon,
107
+ Qr as DarkModeProvider,
108
+ tr as DataSummaryComponentIds,
107
109
  de as DataSummaryGroup,
108
110
  u as DataSummaryPrimitive,
109
111
  te as DefaultToolComponent,
@@ -112,13 +114,13 @@ export {
112
114
  s as EmbeddedChatPrimitive,
113
115
  a as EmbeddedSearch,
114
116
  n as EmbeddedSearchPrimitive,
115
- Wr as ErrorBoundary,
116
- ve as FeedbackProvider,
117
- Be as FormFieldProvider,
118
- ye as HelpMenuProvider,
117
+ jr as ErrorBoundary,
118
+ Be as FeedbackProvider,
119
+ ye as FormFieldProvider,
120
+ we as HelpMenuProvider,
119
121
  N as InkeepChatButton,
120
122
  U as InkeepChatButtonModal,
121
- be as InkeepConfigProvider,
123
+ Pe as InkeepConfigProvider,
122
124
  S as InkeepEmbeddedChat,
123
125
  c as InkeepEmbeddedChatImpl,
124
126
  P as InkeepEmbeddedChatImplContent,
@@ -128,102 +130,103 @@ export {
128
130
  E as InkeepEmbeddedSearchAndChatImpl,
129
131
  H as InkeepEmbeddedSearchImpl,
130
132
  w as InkeepEmbeddedSearchImplContent,
131
- D as InkeepEmbeddedSearchProvider,
133
+ A as InkeepEmbeddedSearchProvider,
132
134
  L as InkeepModal,
133
135
  R as InkeepModalChat,
134
136
  W as InkeepModalSearch,
135
137
  T as InkeepModalSearchAndChat,
136
138
  q as InkeepSearchBar,
137
- Ur as InkeepShadow,
138
- Vr as InkeepShadowProvider,
139
+ Jr as InkeepShadow,
140
+ Xr as InkeepShadowProvider,
139
141
  M as InkeepSidebarChat,
140
142
  _ as LoadingIndicator,
141
- $e as MessageProvider,
143
+ We as MessageProvider,
142
144
  m as Modal,
143
145
  j as ModalContent,
144
146
  C as ModalPrimitive,
145
- lo as ModalProvider,
146
- Ir as Portal,
147
- kr as PortalWithTheme,
148
- ze as RootProvider,
147
+ So as ModalProvider,
148
+ cr as Portal,
149
+ gr as PortalWithTheme,
150
+ Ge as RootProvider,
149
151
  p as SearchBar,
150
- or as SearchBarComponentIds,
152
+ ar as SearchBarComponentIds,
151
153
  J as SearchBarImpl,
152
- h as SearchBarPrimitive,
153
- fo as SearchProvider,
154
- ho as SearchProviderImpl,
154
+ f as SearchBarPrimitive,
155
+ uo as SearchProvider,
156
+ lo as SearchProviderImpl,
155
157
  Y as Shadow,
156
- qr as ShadowContext,
158
+ Yr as ShadowContext,
157
159
  r as SidebarChat,
158
- rr as SidebarChatComponentIds,
160
+ mr as SidebarChatComponentIds,
159
161
  i as SidebarChatPrimitive,
160
- Je as SidebarChatProvider,
161
- je as SourceItemProvider,
162
- Ne as ThemeProvider,
163
- Se as WebWidgetInteractionType,
164
- Ue as WidgetProvider,
165
- tr as aiChatComponentIds,
166
- ar as aiChatHistoryComponentIds,
167
- mr as aiSearchComponentIds,
168
- No as callAll,
169
- dr as chatButtonComponentIds,
170
- pr as componentIDs,
171
- fr as composeRefs,
172
- Qo as dataAttr,
173
- Rr as defaultFilter,
174
- Uo as getInitials,
175
- Vo as getMessageContent,
176
- mo as ikp,
177
- qo as isCitationArtifact,
178
- Jo as isString,
179
- po as jsxFactory,
180
- sr as markDownComponentIds,
181
- Xo as maybeRender,
182
- ur as mergeProps,
183
- ir as miscellanousComponentIds,
184
- nr as modalComponentIds,
185
- Yo as toKebabCase,
162
+ Ze as SidebarChatProvider,
163
+ Ne as SourceItemProvider,
164
+ Ve as ThemeProvider,
165
+ ve as WebWidgetInteractionType,
166
+ Je as WidgetProvider,
167
+ dr as aiChatComponentIds,
168
+ pr as aiChatHistoryComponentIds,
169
+ sr as aiSearchComponentIds,
170
+ Vo as callAll,
171
+ ir as chatButtonComponentIds,
172
+ nr as componentIDs,
173
+ ur as composeRefs,
174
+ qo as dataAttr,
175
+ Or as defaultFilter,
176
+ Jo as getInitials,
177
+ Xo as getMessageContent,
178
+ io as ikp,
179
+ Yo as isCitationArtifact,
180
+ Zo as isString,
181
+ no as jsxFactory,
182
+ Cr as markDownComponentIds,
183
+ _o as maybeRender,
184
+ br as mergeProps,
185
+ hr as miscellanousComponentIds,
186
+ fr as modalComponentIds,
187
+ er as toKebabCase,
186
188
  ie as useBaseEvents,
187
- So as useBoolean,
188
- no as useChat,
189
- oo as useChatBubble,
190
- fe as useChatForm,
191
- he as useChatFormState,
192
- le as useChatHistory,
193
- Ae as useChatMarkdown,
194
- Kr as useColorMode,
195
- Nr as useColorModeValue,
196
- $r as useCommandState,
197
- Tr as useCommandStore,
198
- Po as useComponentClassNames,
199
- hr as useComposedRefs,
200
- ko as useContainerSize,
201
- Eo as useCopyToClipboard,
202
- ge as useFormField,
203
- Fe as useHelpMenu,
204
- He as useHelpMenuState,
205
- ro as useInkeepChatBubble,
206
- ce as useInkeepConfig,
207
- Bo as useInkeepOpenState,
208
- Xe as useInkeepSidebarChat,
209
- Fo as useInstantUpdate,
210
- wo as useIsMounted,
211
- Ao as useMediaQuery,
212
- Te as useMessage,
213
- ke as useMessageFeedback,
214
- Io as useModal,
215
- to as useOptionalChatBubble,
216
- Oe as useOptionalMessage,
217
- Ye as useOptionalSidebarChat,
218
- $o as useResizeObserver,
219
- Oo as useScrollingFades,
220
- Wo as useScrollingFadesHorizontal,
221
- xo as useSearch,
222
- Lo as useSettleAction,
223
- Jr as useShadow,
224
- Ze as useSidebarChat,
225
- Go as useSimpleScroll,
226
- Ge as useSourceItem,
227
- Ve as useWidget,
189
+ vo as useBoolean,
190
+ fo as useChat,
191
+ he as useChatAuth,
192
+ ao as useChatBubble,
193
+ ue as useChatForm,
194
+ le as useChatFormState,
195
+ Se as useChatHistory,
196
+ Te as useChatMarkdown,
197
+ Ur as useColorMode,
198
+ Vr as useColorModeValue,
199
+ Wr as useCommandState,
200
+ zr as useCommandStore,
201
+ Mo as useComponentClassNames,
202
+ lr as useComposedRefs,
203
+ go as useContainerSize,
204
+ Ho as useCopyToClipboard,
205
+ Fe as useFormField,
206
+ Ae as useHelpMenu,
207
+ De as useHelpMenuState,
208
+ mo as useInkeepChatBubble,
209
+ ke as useInkeepConfig,
210
+ yo as useInkeepOpenState,
211
+ _e as useInkeepSidebarChat,
212
+ Ao as useInstantUpdate,
213
+ Ro as useIsMounted,
214
+ To as useMediaQuery,
215
+ ze as useMessage,
216
+ ge as useMessageFeedback,
217
+ co as useModal,
218
+ po as useOptionalChatBubble,
219
+ Le as useOptionalMessage,
220
+ eo as useOptionalSidebarChat,
221
+ Wo as useResizeObserver,
222
+ Lo as useScrollingFades,
223
+ jo as useScrollingFadesHorizontal,
224
+ Io as useSearch,
225
+ Ko as useSettleAction,
226
+ Zr as useShadow,
227
+ oo as useSidebarChat,
228
+ Qo as useSimpleScroll,
229
+ Qe as useSourceItem,
230
+ Xe as useWidget,
228
231
  oe as widgetToggle
229
232
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),ne=require("../../primitives/providers/base-events-provider.cjs"),oe=require("../../primitives/providers/config-provider.cjs"),ie=require("../../primitives/providers/message-provider.cjs"),T=require("../../primitives/components/embedded-chat.cjs"),le=require("../../primitives/components/embedded-chat/chat-provider.cjs"),ce=require("../../primitives/utils/misc.cjs"),de=require("merge-anything"),k=require("../utils.cjs"),pe=require("./ui/markdown-styles.cjs"),ue=require("../../primitives/components/embedded-chat/use-stream-processor.cjs"),me=require("./data-summary-group.cjs"),n=require("react"),_=require("./embedded-chat.cjs"),xe=require("./ask-user-form.cjs"),d=require("lucide-react"),H=require("./ui/recipes/button.cjs"),K="askUser",J=`tool-${K}`,he={"input-streaming":"Pending","input-available":"Running","approval-requested":"Awaiting Approval","approval-responded":"Responded","output-available":"Completed","output-error":"Error","output-denied":"Denied"};function fe(t){if(!t||typeof t!="object")return!1;const a=t;return typeof a.type=="string"&&a.type.startsWith("tool-")}const ye=t=>{if(!t||typeof t!="object"||!("status"in t))return;const a=t.status;return typeof a=="string"?a:void 0},ge=()=>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))}),Y=({name:t,Icon:a,props:l,componentType:o})=>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:o})]}),e.jsx("div",{className:"px-4 py-2",children:e.jsx(ee,{value:l})})]}),be=({name:t,props:a})=>e.jsx(Y,{name:t,Icon:d.ComponentIcon,props:a,componentType:"component"}),je=({name:t,props:a})=>e.jsx(Y,{name:t,Icon:d.Library,props:a,componentType:"artifact"}),we=({tool:t,componentDef:a,renderText:l,approvalId:o,messagePartsLength:c,setApprovalDelayPending:s,addToolApprovalResponse:x,addToolOutput:p,sendMessage:b,conversationId:i})=>{const u=n.useRef(b);u.current=b;const m=n.useRef(x);m.current=x;const h=n.useRef(p);h.current=p;const y=n.useRef(s);y.current=s;const M=n.useCallback(async(f=!0)=>{o&&(y.current({partCount:c}),m.current({id:o,approved:f}),await u.current(void 0,{body:{conversationId:i}}))},[o,c,i]),I=n.useCallback(async f=>{if(!t.toolCallId)return;y.current({partCount:c});const v=t.input;try{await h.current({tool:K,toolCallId:t.toolCallId,output:{form:v.form,answers:f,...v.message!==void 0?{message:v.message}:{}}}),await u.current(void 0,{body:{conversationId:i}})}catch(D){console.error("[askUser] submit failed",D),y.current(null)}},[t.toolCallId,t.input,c,i]),U=n.useCallback(async()=>{if(t.toolCallId){y.current({partCount:c});try{await h.current({state:"output-error",tool:K,toolCallId:t.toolCallId,errorText:"User declined to provide input."}),await u.current(void 0,{body:{conversationId:i}})}catch(f){console.error("[askUser] decline failed",f),y.current(null)}}},[t.toolCallId,c,i]),O=n.useMemo(()=>({tool:t,approve:M,renderMarkdown:l}),[t]);if(t.type===J){const f=t.input&&typeof t.input=="object"?t.input:void 0,v=!!f&&Array.isArray(f.form),D=v?t.input:void 0,$=t.state==="output-available"&&t.output?t.output:void 0;let N;return t.state==="output-available"?N="submitted":t.state==="output-error"?N="declined":v&&t.state==="input-available"?N="active":N="pending",e.jsx(xe.AskUserForm,{input:D,output:$,status:N,errorText:t.state==="output-error"&&"errorText"in t?t.errorText:void 0,onSubmit:I,onDecline:U})}const R=a?_.DynamicComponent:te;return e.jsx(R,{name:t.type,props:O,componentDef:a})};function Q(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:k.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 Z=({name:t,value:a,isArrayIndex:l,depth:o=0})=>{const[c,s]=n.useState(o<1),x=a!==null&&typeof a=="object"&&!Array.isArray(a),p=Array.isArray(a);if(!(x||p))return e.jsxs("div",{className:"flex items-baseline gap-2 py-1 text-xs",children:[e.jsx("span",{className:k.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:Q(a)})]});const i=p?a.map((m,h)=>[String(h),m]):Object.entries(a);return i.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:p?"empty list":"empty"})]}):e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:m=>{m.stopPropagation(),s(!c)},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:k.cn("h-3.5 w-3.5 text-gray-400 dark:text-white-alpha-400 shrink-0 transition-transform",!c&&"-rotate-90")}),e.jsx("span",{className:"font-medium text-gray-500 dark:text-white-alpha-500",children:t}),!c&&e.jsx("span",{className:"text-gray-400 dark:text-white-alpha-400 text-1xs ml-1",children:p?`${i.length} item${i.length!==1?"s":""}`:`${i.length} field${i.length!==1?"s":""}`})]}),c&&e.jsx("div",{className:"border-l-2 border-gray-200 dark:border-white-alpha-200 ml-1.5 pl-3",children:i.map(([m,h])=>e.jsx(Z,{name:m,value:h,isArrayIndex:p,depth:o+1},m))})]})},ee=({value:t})=>{if(t==null||typeof t!="object")return e.jsx("span",{className:"text-xs",children:Q(t)});const a=Array.isArray(t)?t.map((l,o)=>[String(o),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,o])=>e.jsx(Z,{name:l,value:o,isArrayIndex:Array.isArray(t)},l))})},te=({props:t})=>{const{tool:a,approve:l}=t,o=a.type,c=o.startsWith("tool-")?o.slice(5):o,s=a.state,x=a.approval?.id,p=!!x,b=s==="approval-requested",i=ye(a.output),[u,m]=n.useState(p),h=s?he[s]??s:"tool";n.useEffect(()=>{b&&m(!0)},[b]);const y=()=>{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:()=>m(!u),"aria-expanded":u,"data-expanded":u,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:c})]})}),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:[y(),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":u,className:k.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":u,className:k.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":u,className:k.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(ee,{value:a.input})})})}),b&&x&&e.jsxs("div",{className:"flex justify-end gap-2 pt-1 pb-3 px-4",children:[e.jsx("button",{type:"button",className:k.cn(H.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:k.cn(H.button({size:"xs",variant:"primaryFilled"}),"px-2 py-1 rounded-md text-xs gap-1"),onClick:()=>l(!0),children:[e.jsx(d.Check,{className:"w-3 h-3"}),"Approve"]})]}),s==="output-available"&&i&&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:[i==="approved"&&e.jsx(d.Check,{className:"w-3 h-3"}),i]}),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]})]})]})},ke=({className:t,componentStyles:a,children:l,isLast:o,...c})=>{const{message:s}=ie.useMessage(),{logEvent:x}=ne.useBaseEvents(),{conversationId:p,isStreaming:b,isLoading:i,setError:u,addToolApprovalResponse:m,addToolOutput:h,sendMessage:y}=le.useChat(),{aiChatSettings:{components:M,artifacts:I,headers:U}}=oe.useInkeepConfig(),O=U?.["x-emit-operations"]==="true",R=s.role==="user",f=(b||i)&&o&&s.role==="assistant",{processedParts:v,summaryTimings:D,shouldShowInitialLoading:$,shouldShowStreamDelayLoading:N}=ue.useStreamProcessor(s.parts,f,u),[P,V]=n.useState(null),[ae,L]=n.useState(!1),j=n.useRef(null);n.useEffect(()=>{if(!P){L(!1),j.current&&(clearTimeout(j.current),j.current=null);return}return L(!1),j.current&&clearTimeout(j.current),j.current=window.setTimeout(()=>{L(!0)},1e3),()=>{j.current&&(clearTimeout(j.current),j.current=null)}},[P]),n.useEffect(()=>{P&&(!o||s.parts.length>P.partCount||!f)&&V(null)},[P,o,s.parts.length,f]);const B=n.useMemo(()=>s.parts.filter(ce.isCitationArtifact),[s.parts]),G=n.useMemo(()=>de.merge(pe.markdownStyles,a??{}),[a]),W=n.useCallback((r,g)=>{x({eventName:"assistant_message_inline_link_opened",properties:{title:g?.toString(),url:r}})},[x]),X=n.useCallback((r,g)=>{x({eventName:"assistant_code_block_copied",properties:{conversationId:p,language:r,code:g}})},[x,p]),z=n.useCallback(r=>e.jsx(T.EmbeddedChatPrimitiveMarkdown,{text:r,componentStyles:G,onLinkClick:W,onCodeCopy:X,artifacts:B}),[G,W,X,B]),re=n.useMemo(()=>k.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]),se=!R||s.parts.some(r=>r.type==="text"&&r.text?.trim());return e.jsxs(e.Fragment,{children:[!se&&e.jsx("span",{className:"text-gray-500 dark:text-white-alpha-500",children:"No message content"}),v.map((r,g)=>{const S={"data-role":s.role,"data-type":r?.type==="data-component"?r.data.type:r?.type,...c,className:re};switch(r?.type){case"text":return e.jsx(T.PrimitiveMessagePart,{...S,children:R?r.text:z(r.text||"")},g);case"data-component":{const{type:C}=r.data;switch(C){case"text":return e.jsx("div",{...S,children:z(r.data.text||"")},g);default:{const A=r.data,{name:w,props:E}=A,q=M?.[w],F=q?_.DynamicComponent:be;return e.jsx(T.PrimitiveMessagePart,{...S,children:e.jsx(F,{name:w,props:E,componentDef:q})},`${w}-${g}`)}}}case"data-artifact":{const C=r.data,{name:A,type:w,artifactSummary:E}=C;if(w==="citation"&&!E?.url)return null;const q=I?.[w],F=q?_.DynamicComponent:je;return e.jsx(T.PrimitiveMessagePart,{...S,children:e.jsx(F,{name:w,props:E,componentDef:q})},`${A}-${g}`)}case"summary-group":{const C=D.get(r.groupKey)||{isCompleted:!1};return e.jsx(T.PrimitiveMessagePart,{...S,children:e.jsx(me.DataSummaryGroup,{summaries:r.summaries||[],isCompleted:C.isCompleted})},`${r.groupKey}-${g}`)}default:{if(!fe(r))return null;const C=r,A=r.approval?.id,w=C.type===J;return O||A||w?e.jsx(T.PrimitiveMessagePart,{...S,children:e.jsx(we,{tool:C,componentDef:M?.IkpTool,renderText:z,approvalId:A,messagePartsLength:s.parts.length,setApprovalDelayPending:V,addToolApprovalResponse:m,addToolOutput:h,sendMessage:y,conversationId:p})},r.toolCallId??`${r.type}-${g}`):null}}}),$&&e.jsx(_.MessageLoading,{}),(N||ae)&&e.jsx(ge,{})]})};exports.DefaultToolComponent=te;exports.EmbeddedChatMessagePart=ke;
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: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: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",L=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=!L||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:L?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],$=P?T.DynamicComponent:he;return e.jsx(C.PrimitiveMessagePart,{...v,children:e.jsx($,{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],$=P?T.DynamicComponent:fe;return e.jsx(C.PrimitiveMessagePart,{...v,children:e.jsx($,{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;