@inkeep/agents-ui 0.15.1 → 0.15.2

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.
@@ -1,3 +1,3 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("@ai-sdk/react"),Y=require("ai"),t=require("react"),Z=require("../../providers/config-provider.cjs"),ee=require("../../hooks/use-media-query.cjs"),te=require("../../utils/generate-uid.cjs"),se=require("../../providers/base-events-provider.cjs"),ne=require("../../providers/chat-form-provider.cjs"),re=require("../../providers/widget-provider.cjs"),ae=require("@radix-ui/react-use-controllable-state"),oe=require("../../hooks/use-streaming-events.cjs"),F=`Hmm..
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Z=require("@ai-sdk/react"),ee=require("ai"),s=require("react"),te=require("../../providers/config-provider.cjs"),se=require("../../hooks/use-media-query.cjs"),R=require("../../utils/generate-uid.cjs"),ne=require("../../providers/base-events-provider.cjs"),re=require("../../providers/chat-form-provider.cjs"),ae=require("../../providers/widget-provider.cjs"),oe=require("@radix-ui/react-use-controllable-state"),ie=require("../../hooks/use-streaming-events.cjs"),x=`Hmm..
2
2
 
3
- It seems I might be having some issues right now. Please clear the chat and try again.`,ie=()=>{const{baseSettings:v,aiChatSettings:o}=Z.useInkeepConfig(),[s="",E]=ae.useControllableState({prop:o.conversationId,defaultProp:o.conversationId??""}),{logEvent:i}=se.useBaseEvents(),{setConversationId:R,emitToParent:u}=oe.useStreamingEvents(),[a,l]=t.useState(""),P=e=>l(e.target.value),{filters:S}=v,{onInputMessageChange:k,filters:b,agentUrl:A,context:D,headers:x,apiKey:C}=o,N=e=>{switch(e.code){case 400:return e.message;case 403:return`There seems to be a configuration error. Please contact ${v.organizationDisplayName??"Administrator"}`;default:return F}},[T,U]=t.useState({}),[B,d]=t.useState([]),[O,I]=t.useState(null),{messages:g,sendMessage:K,status:y,setMessages:w,stop:L,error:m}=X.useChat({transport:new Y.DefaultChatTransport({api:A,headers:{...C?{Authorization:`Bearer ${C}`}:{},...x},body:{requestContext:D}}),onData(e){u(e.type,e.data)},async onFinish(){u("completion",{conversationId:s}),await i({eventName:"assistant_message_received",properties:{conversationId:s}}),i({eventName:"assistant_answer_displayed",properties:{conversationId:s}})},onError(e){console.log("onError",e.message),w(c=>{const r=[...c],n=r[r.length-1];return n&&(n.parts=[{type:"text",text:N(e)}]),r})}}),M=y==="submitted",W=y==="streaming",$=g.length===0,p=!a.trim()||M,z=ee.useMediaQuery("(max-width: 768px)"),[G,h]=t.useState(null);t.useEffect(()=>{m&&h(m)},[m]);const H=()=>h(null),_=t.useRef(null);t.useEffect(()=>{k?.(a)},[a]);const Q=e=>{e.key==="Enter"&&!e.shiftKey&&!p&&!e.nativeEvent.isComposing&&(e.preventDefault(),f())},f=async(e=a)=>{if(p&&(!e||e.trim().length===0))return;d([]),l(""),await i({eventName:"user_message_submitted",properties:{conversationId:s}});const c=S||b?JSON.stringify({...S,...b}):void 0,r={};c&&(r["inkeep-filters"]=c);let n=s;n||(n=`conv_${te.generateUid(16)}`,E(n)),R(n),K({text:e},{headers:r,body:{conversationId:n}})},j=()=>{L().then(()=>{u("aborted",{conversationId:s})})},q=()=>{H(),w([]),E(""),U({}),d([]),I(null),i({eventName:"chat_clear_button_clicked",properties:{conversationId:s}})},{openForm:J}=ne.useChatForm(),V=re.useWidget();return t.useImperativeHandle(o.chatFunctionsRef,()=>({submitMessage:f,updateInputMessage(e){l(e)},clearChat:q,openForm:e=>{V?.setView("chat"),J(e,void 0)},focusInput:()=>{_.current?.focus()}})),{messages:g,isLoading:M,isStreaming:W,error:G,setError:h,isSubmitDisabled:p,input:a,handleInputChange:P,handleInputKeyDown:Q,handleSubmit:f,stop:j,clear:q,messageButtons:T,isEmpty:g.length===0,inputRef:_,isMobile:z,messageAttachments:B,setMessageAttachments:d,selectedWorkflow:O,setSelectedWorkflow:I,isNewChat:$,conversationId:s}};exports.DEFAULT_ERROR_MESSAGE=F;exports.useInkeepChat=ie;
3
+ It seems I might be having some issues right now. Please clear the chat and try again.`,ce=()=>{const{baseSettings:v,aiChatSettings:o}=te.useInkeepConfig(),[n="",E]=oe.useControllableState({prop:o.conversationId,defaultProp:o.conversationId??""}),{logEvent:i}=ne.useBaseEvents(),{setConversationId:P,emitToParent:u}=ie.useStreamingEvents(),[a,l]=s.useState(""),k=e=>l(e.target.value),{filters:S}=v,{onInputMessageChange:A,filters:b,agentUrl:D,context:N,headers:U,apiKey:y}=o,T=e=>{switch(e.code){case 400:return e.message;case 403:return`There seems to be a configuration error. Please contact ${v.organizationDisplayName??"Administrator"}`;default:return x}},[B,O]=s.useState({}),[K,d]=s.useState([]),[L,C]=s.useState(null),{messages:g,sendMessage:W,status:I,setMessages:M,stop:$,error:p}=Z.useChat({transport:new ee.DefaultChatTransport({api:D,headers:{...y?{Authorization:`Bearer ${y}`}:{},...U},body:{requestContext:N}}),onData(e){u(e.type,e.data)},async onFinish(){u("completion",{conversationId:n}),await i({eventName:"assistant_message_received",properties:{conversationId:n}}),i({eventName:"assistant_answer_displayed",properties:{conversationId:n}})},onError(e){console.log("onError",e.message),M(c=>{const r=[...c],t=r[r.length-1];if(t){const F=T(e);t.role==="user"?r.push({id:R.generateUid(16),role:"assistant",parts:[{type:"text",text:F}]}):t.parts=[{type:"text",text:F}]}return r})}}),w=I==="submitted",z=I==="streaming",G=g.length===0,m=!a.trim()||w,H=se.useMediaQuery("(max-width: 768px)"),[Q,h]=s.useState(null);s.useEffect(()=>{p&&h(p)},[p]);const j=()=>h(null),_=s.useRef(null);s.useEffect(()=>{A?.(a)},[a]);const J=e=>{e.key==="Enter"&&!e.shiftKey&&!m&&!e.nativeEvent.isComposing&&(e.preventDefault(),f())},f=async(e=a)=>{if(m&&(!e||e.trim().length===0))return;d([]),l(""),await i({eventName:"user_message_submitted",properties:{conversationId:n}});const c=S||b?JSON.stringify({...S,...b}):void 0,r={};c&&(r["inkeep-filters"]=c);let t=n;t||(t=`conv_${R.generateUid(16)}`,E(t)),P(t),W({text:e},{headers:r,body:{conversationId:t}})},V=()=>{$().then(()=>{u("aborted",{conversationId:n})})},q=()=>{j(),M([]),E(""),O({}),d([]),C(null),i({eventName:"chat_clear_button_clicked",properties:{conversationId:n}})},{openForm:X}=re.useChatForm(),Y=ae.useWidget();return s.useImperativeHandle(o.chatFunctionsRef,()=>({submitMessage:f,updateInputMessage(e){l(e)},clearChat:q,openForm:e=>{Y?.setView("chat"),X(e,void 0)},focusInput:()=>{_.current?.focus()}})),{messages:g,isLoading:w,isStreaming:z,error:Q,setError:h,isSubmitDisabled:m,input:a,handleInputChange:k,handleInputKeyDown:J,handleSubmit:f,stop:V,clear:q,messageButtons:B,isEmpty:g.length===0,inputRef:_,isMobile:H,messageAttachments:K,setMessageAttachments:d,selectedWorkflow:L,setSelectedWorkflow:C,isNewChat:G,conversationId:n}};exports.DEFAULT_ERROR_MESSAGE=x;exports.useInkeepChat=ce;
@@ -1,105 +1,113 @@
1
1
  "use client";
2
- import { useChat as X } from "@ai-sdk/react";
3
- import { DefaultChatTransport as Y } from "ai";
4
- import { useState as r, useEffect as F, useRef as Z, useImperativeHandle as ee } from "react";
5
- import { useInkeepConfig as te } from "../../providers/config-provider.js";
6
- import { useMediaQuery as se } from "../../hooks/use-media-query.js";
7
- import { generateUid as ne } from "../../utils/generate-uid.js";
8
- import { useBaseEvents as oe } from "../../providers/base-events-provider.js";
9
- import { useChatForm as re } from "../../providers/chat-form-provider.js";
10
- import { useWidget as ae } from "../../providers/widget-provider.js";
11
- import { useControllableState as ie } from "@radix-ui/react-use-controllable-state";
12
- import { useStreamingEvents as ce } from "../../hooks/use-streaming-events.js";
13
- const me = `Hmm..
2
+ import { useChat as Z } from "@ai-sdk/react";
3
+ import { DefaultChatTransport as ee } from "ai";
4
+ import { useState as r, useEffect as k, useRef as te, useImperativeHandle as se } from "react";
5
+ import { useInkeepConfig as ne } from "../../providers/config-provider.js";
6
+ import { useMediaQuery as oe } from "../../hooks/use-media-query.js";
7
+ import { generateUid as D } from "../../utils/generate-uid.js";
8
+ import { useBaseEvents as re } from "../../providers/base-events-provider.js";
9
+ import { useChatForm as ae } from "../../providers/chat-form-provider.js";
10
+ import { useWidget as ie } from "../../providers/widget-provider.js";
11
+ import { useControllableState as ce } from "@radix-ui/react-use-controllable-state";
12
+ import { useStreamingEvents as me } from "../../hooks/use-streaming-events.js";
13
+ const le = `Hmm..
14
14
 
15
15
  It seems I might be having some issues right now. Please clear the chat and try again.`, be = () => {
16
- const { baseSettings: v, aiChatSettings: a } = te(), [t = "", I] = ie({
16
+ const { baseSettings: v, aiChatSettings: a } = ne(), [s = "", I] = ce({
17
17
  prop: a.conversationId,
18
18
  defaultProp: a.conversationId ?? ""
19
- }), { logEvent: i } = oe(), { setConversationId: k, emitToParent: m } = ce(), [o, u] = r(""), D = (e) => u(e.target.value), {
19
+ }), { logEvent: i } = re(), { setConversationId: N, emitToParent: m } = me(), [o, l] = r(""), A = (e) => l(e.target.value), {
20
20
  /* shouldBypassCaptcha, */
21
21
  filters: C
22
22
  } = v, {
23
- onInputMessageChange: N,
24
- filters: E,
25
- agentUrl: A,
26
- context: R,
27
- headers: B,
28
- apiKey: b
29
- } = a, P = (e) => {
23
+ onInputMessageChange: R,
24
+ filters: y,
25
+ agentUrl: B,
26
+ context: P,
27
+ headers: T,
28
+ apiKey: E
29
+ } = a, K = (e) => {
30
30
  switch (e.code) {
31
31
  case 400:
32
32
  return e.message;
33
33
  case 403:
34
34
  return `There seems to be a configuration error. Please contact ${v.organizationDisplayName ?? "Administrator"}`;
35
35
  default:
36
- return me;
36
+ return le;
37
37
  }
38
- }, [T, K] = r({}), [U, l] = r([]), [W, y] = r(null), {
38
+ }, [U, W] = r({}), [$, u] = r([]), [z, b] = r(null), {
39
39
  messages: p,
40
- sendMessage: $,
40
+ sendMessage: H,
41
41
  status: w,
42
42
  setMessages: S,
43
- stop: z,
43
+ stop: L,
44
44
  error: g
45
- } = X({
46
- transport: new Y({
47
- api: A,
45
+ } = Z({
46
+ transport: new ee({
47
+ api: B,
48
48
  headers: {
49
- ...b ? { Authorization: `Bearer ${b}` } : {},
50
- ...B
49
+ ...E ? { Authorization: `Bearer ${E}` } : {},
50
+ ...T
51
51
  },
52
52
  body: {
53
- requestContext: R
53
+ requestContext: P
54
54
  }
55
55
  }),
56
56
  onData(e) {
57
57
  m(e.type, e.data);
58
58
  },
59
59
  async onFinish() {
60
- m("completion", { conversationId: t }), await i({
60
+ m("completion", { conversationId: s }), await i({
61
61
  eventName: "assistant_message_received",
62
62
  properties: {
63
- conversationId: t
63
+ conversationId: s
64
64
  }
65
65
  }), i({
66
66
  eventName: "assistant_answer_displayed",
67
67
  properties: {
68
- conversationId: t
68
+ conversationId: s
69
69
  }
70
70
  });
71
71
  },
72
72
  onError(e) {
73
73
  console.log("onError", e.message), S((c) => {
74
- const n = [...c], s = n[n.length - 1];
75
- return s && (s.parts = [{ type: "text", text: P(e) }]), n;
74
+ const n = [...c], t = n[n.length - 1];
75
+ if (t) {
76
+ const F = K(e);
77
+ t.role === "user" ? n.push({
78
+ id: D(16),
79
+ role: "assistant",
80
+ parts: [{ type: "text", text: F }]
81
+ }) : t.parts = [{ type: "text", text: F }];
82
+ }
83
+ return n;
76
84
  });
77
85
  }
78
- }), M = w === "submitted", H = w === "streaming", L = p.length === 0, d = !o.trim() || M, O = se("(max-width: 768px)"), [q, h] = r(null);
79
- F(() => {
86
+ }), M = w === "submitted", O = w === "streaming", q = p.length === 0, d = !o.trim() || M, G = oe("(max-width: 768px)"), [J, h] = r(null);
87
+ k(() => {
80
88
  g && h(g);
81
89
  }, [g]);
82
- const G = () => h(null), _ = Z(null);
83
- F(() => {
84
- N?.(o);
90
+ const Q = () => h(null), _ = te(null);
91
+ k(() => {
92
+ R?.(o);
85
93
  }, [o]);
86
- const J = (e) => {
94
+ const V = (e) => {
87
95
  e.key === "Enter" && !e.shiftKey && !d && !e.nativeEvent.isComposing && (e.preventDefault(), f());
88
96
  }, f = async (e = o) => {
89
97
  if (d && (!e || e.trim().length === 0)) return;
90
- l([]), u(""), await i({
98
+ u([]), l(""), await i({
91
99
  eventName: "user_message_submitted",
92
100
  properties: {
93
- conversationId: t
101
+ conversationId: s
94
102
  }
95
103
  });
96
- const c = C || E ? JSON.stringify({
104
+ const c = C || y ? JSON.stringify({
97
105
  ...C,
98
- ...E
106
+ ...y
99
107
  }) : void 0, n = {};
100
108
  c && (n["inkeep-filters"] = c);
101
- let s = t;
102
- s || (s = `conv_${ne(16)}`, I(s)), k(s), $(
109
+ let t = s;
110
+ t || (t = `conv_${D(16)}`, I(t)), N(t), H(
103
111
  // { ...userMessage, files },
104
112
  // { ...userMessage, },
105
113
  {
@@ -108,30 +116,30 @@ It seems I might be having some issues right now. Please clear the chat and try
108
116
  {
109
117
  headers: n,
110
118
  body: {
111
- conversationId: s
119
+ conversationId: t
112
120
  }
113
121
  }
114
122
  );
115
- }, Q = () => {
116
- z().then(() => {
117
- m("aborted", { conversationId: t });
123
+ }, j = () => {
124
+ L().then(() => {
125
+ m("aborted", { conversationId: s });
118
126
  });
119
127
  }, x = () => {
120
- G(), S([]), I(""), K({}), l([]), y(null), i({
128
+ Q(), S([]), I(""), W({}), u([]), b(null), i({
121
129
  eventName: "chat_clear_button_clicked",
122
130
  properties: {
123
- conversationId: t
131
+ conversationId: s
124
132
  }
125
133
  });
126
- }, { openForm: V } = re(), j = ae();
127
- return ee(a.chatFunctionsRef, () => ({
134
+ }, { openForm: X } = ae(), Y = ie();
135
+ return se(a.chatFunctionsRef, () => ({
128
136
  submitMessage: f,
129
137
  updateInputMessage(e) {
130
- u(e);
138
+ l(e);
131
139
  },
132
140
  clearChat: x,
133
141
  openForm: (e) => {
134
- j?.setView("chat"), V(e, void 0);
142
+ Y?.setView("chat"), X(e, void 0);
135
143
  },
136
144
  focusInput: () => {
137
145
  _.current?.focus();
@@ -139,30 +147,30 @@ It seems I might be having some issues right now. Please clear the chat and try
139
147
  })), {
140
148
  messages: p,
141
149
  isLoading: M,
142
- isStreaming: H,
143
- error: q,
150
+ isStreaming: O,
151
+ error: J,
144
152
  setError: h,
145
153
  isSubmitDisabled: d,
146
154
  input: o,
147
- handleInputChange: D,
148
- handleInputKeyDown: J,
155
+ handleInputChange: A,
156
+ handleInputKeyDown: V,
149
157
  handleSubmit: f,
150
- stop: Q,
158
+ stop: j,
151
159
  clear: x,
152
- messageButtons: T,
160
+ messageButtons: U,
153
161
  isEmpty: p.length === 0,
154
162
  inputRef: _,
155
- isMobile: O,
163
+ isMobile: G,
156
164
  // Additional state for attachments and workflow
157
- messageAttachments: U,
158
- setMessageAttachments: l,
159
- selectedWorkflow: W,
160
- setSelectedWorkflow: y,
161
- isNewChat: L,
162
- conversationId: t
165
+ messageAttachments: $,
166
+ setMessageAttachments: u,
167
+ selectedWorkflow: z,
168
+ setSelectedWorkflow: b,
169
+ isNewChat: q,
170
+ conversationId: s
163
171
  };
164
172
  };
165
173
  export {
166
- me as DEFAULT_ERROR_MESSAGE,
174
+ le as DEFAULT_ERROR_MESSAGE,
167
175
  be as useInkeepChat
168
176
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),t=require("react"),l=require("./config-provider.cjs"),a=t.createContext(void 0),p=({children:e})=>{const{baseSettings:s,componentType:n}=l.useInkeepConfig(),{tags:o,analyticsProperties:r}=s,i=t.useMemo(()=>({widgetLibraryVersion:"0.15.0",componentType:n,tags:o}),[n,o]),u={logEvent:t.useCallback(async c=>{const v={...i,...c.properties,...r},d={eventName:c.eventName,properties:v};return s.onEvent?.(d)},[s,i,r])};return E.jsx(a.Provider,{value:u,children:e})},g=()=>{const e=t.useContext(a);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=p;exports.useBaseEvents=g;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),t=require("react"),l=require("./config-provider.cjs"),a=t.createContext(void 0),p=({children:e})=>{const{baseSettings:s,componentType:n}=l.useInkeepConfig(),{tags:o,analyticsProperties:r}=s,i=t.useMemo(()=>({widgetLibraryVersion:"0.15.1",componentType:n,tags:o}),[n,o]),u={logEvent:t.useCallback(async c=>{const v={...i,...c.properties,...r},d={eventName:c.eventName,properties:v};return s.onEvent?.(d)},[s,i,r])};return E.jsx(a.Provider,{value:u,children:e})},g=()=>{const e=t.useContext(a);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=p;exports.useBaseEvents=g;
@@ -5,7 +5,7 @@ import { useInkeepConfig as g } from "./config-provider.js";
5
5
  const a = d(void 0), P = ({ children: e }) => {
6
6
  const { baseSettings: t, componentType: o } = g(), { tags: s, analyticsProperties: n } = t, r = u(
7
7
  () => ({
8
- widgetLibraryVersion: "0.15.0",
8
+ widgetLibraryVersion: "0.15.1",
9
9
  componentType: o,
10
10
  tags: s
11
11
  }),
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),a=require("lucide-react"),r=require("../../primitives/components/data-summaries.cjs"),m=t=>{const{type:l,label:s}=t;return s||l.replace(/_/g," ").replace(/\b\w/g,i=>i.toUpperCase())},d={agent_generate:e.jsx(a.RefreshCw,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),agent_reasoning:e.jsx(a.Brain,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),tool_call:e.jsx(a.Hammer,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),tool_result:e.jsx(a.Hammer,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),transfer:e.jsx(a.ArrowRight,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),delegation_sent:e.jsx(a.Forward,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),delegation_returned:e.jsx(a.CheckCheck,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),artifact_saved:e.jsx(a.Download,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),error:e.jsx(a.TriangleAlert,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),agent_initializing:e.jsx(a.CircleDot,{className:"w-3 h-3 animate-spin"}),completion:e.jsx(a.CheckCheck,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),default:e.jsx(a.Dot,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"})},h={retrieve:e.jsx(a.Search,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),action:e.jsx(a.CheckCheck,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),...d},p=n.memo(({summary:t,showConnector:l})=>{const s=n.useMemo(()=>t.details?JSON.stringify(t.details,null,2):null,[t.details]),i=n.useMemo(()=>m(t),[t]),c=n.useMemo(()=>h[t.type]||h.default,[t.type]);return e.jsxs(r.DataSummaryItem,{className:"flex items-start gap-2 text-xs relative",children:[l&&e.jsx(r.DataSummaryConnector,{className:"absolute left-1.5 top-4 bottom-0 w-px bg-gray-200 dark:bg-white-alpha-200 -mb-3"}),e.jsx(r.DataSummaryIconContainer,{className:"flex items-center justify-center w-3 h-3 relative z-10 mt-0.5",children:c}),e.jsxs(r.DataSummaryContent,{className:"flex-1",children:[e.jsx(r.DataSummaryLabel,{className:"text-gray-700 dark:text-white-alpha-600",children:i}),s&&e.jsx(r.DataSummaryDetails,{className:"mt-2 text-xs whitespace-pre-wrap font-mono bg-gray-50 dark:bg-gray-dark-900 p-2 rounded-md px-3 py-2",children:s})]})]})}),u=n.memo(({summaries:t,isCompleted:l})=>{const[s,i]=n.useState(!l);n.useEffect(()=>{let o;return l?o=setTimeout(()=>{i(!1)},1e3):i(!0),()=>{o&&clearTimeout(o)}},[l]);const c=n.useCallback(()=>{i(!s)},[s]);return e.jsxs(r.DataSummaryGroup,{className:"flex flex-col items-start mb-2.5 mt-2.5 first:mt-1 relative",children:[e.jsx(r.DataSummaryToggle,{type:"button",onClick:c,"data-expanded":s,className:"inline-flex items-center group gap-2 text-xs text-gray-500 dark:text-white-alpha-600 hover:text-gray-700 dark:hover:text-white-alpha-700 transition-colors cursor-pointer",children:l?e.jsxs(e.Fragment,{children:[e.jsx(a.Check,{className:"check-icon w-3 h-3 text-gray-500 dark:text-white-alpha-500 transition-all duration-200 absolute opacity-100 group-hover:opacity-0 group-data-[expanded=true]:opacity-0"}),e.jsx(a.ChevronRight,{className:"chevron-icon w-3 h-3 text-gray-500 dark:text-white-alpha-500 transition-all duration-200 transform opacity-0 rotate-0 group-hover:opacity-100 group-data-[expanded=true]:opacity-100 group-data-[expanded=true]:rotate-90"}),e.jsx(r.DataSummaryToggleText,{className:"font-medium",children:"Completed"})]}):e.jsxs(e.Fragment,{children:[e.jsx(a.LoaderCircle,{className:"w-3 h-3 animate-spin"}),e.jsx(r.DataSummaryToggleText,{className:"font-medium",children:"Thinking..."})]})}),e.jsx(r.DataSummaryCollapsible,{"data-expanded":s,className:"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(r.DataSummaryList,{className:"pb-2 mt-1.5 space-y-3 relative",children:t.map((o,x)=>e.jsx(p,{summary:o,showConnector:t.length>1&&x<t.length-1},`op-${o.type}-${x}`))})})]})});exports.DataSummaryGroup=u;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),a=require("lucide-react"),r=require("../../primitives/components/data-summaries.cjs"),d=t=>{const{type:l,label:s}=t;return s||l.replace(/_/g," ").replace(/\b\w/g,i=>i.toUpperCase())},m={agent_generate:e.jsx(a.RefreshCw,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),agent_reasoning:e.jsx(a.Brain,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),tool_call:e.jsx(a.Hammer,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),tool_result:e.jsx(a.Hammer,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),transfer:e.jsx(a.ArrowRight,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),delegation_sent:e.jsx(a.Forward,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),delegation_returned:e.jsx(a.CheckCheck,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),artifact_saved:e.jsx(a.Download,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),error:e.jsx(a.TriangleAlert,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),agent_initializing:e.jsx(a.CircleDot,{className:"w-3 h-3 animate-spin"}),completion:e.jsx(a.CheckCheck,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),default:e.jsx(a.Dot,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"})},h={retrieve:e.jsx(a.Search,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),action:e.jsx(a.CheckCheck,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),...m},p=n.memo(({summary:t,showConnector:l})=>{const s=n.useMemo(()=>t.details&&Object.keys(t.details).length>0?JSON.stringify(t.details,null,2):null,[t.details]),i=n.useMemo(()=>d(t),[t]),c=n.useMemo(()=>h[t.type]||h.default,[t.type]);return e.jsxs(r.DataSummaryItem,{className:"flex items-start gap-2 text-xs relative",children:[l&&e.jsx(r.DataSummaryConnector,{className:"absolute left-1.5 top-4 bottom-0 w-px bg-gray-200 dark:bg-white-alpha-200 -mb-3"}),e.jsx(r.DataSummaryIconContainer,{className:"flex items-center justify-center w-3 h-3 relative z-10 mt-0.5",children:c}),e.jsxs(r.DataSummaryContent,{className:"flex-1",children:[e.jsx(r.DataSummaryLabel,{className:"text-gray-700 dark:text-white-alpha-600",children:i}),s&&e.jsx(r.DataSummaryDetails,{className:"mt-2 text-xs whitespace-pre-wrap font-mono bg-gray-50 dark:bg-gray-dark-900 p-2 rounded-md px-3 py-2",children:s})]})]})}),g=n.memo(({summaries:t,isCompleted:l})=>{const[s,i]=n.useState(!l);n.useEffect(()=>{let o;return l?o=setTimeout(()=>{i(!1)},1e3):i(!0),()=>{o&&clearTimeout(o)}},[l]);const c=n.useCallback(()=>{i(!s)},[s]);return e.jsxs(r.DataSummaryGroup,{className:"flex flex-col items-start mb-2.5 mt-2.5 first:mt-1 relative",children:[e.jsx(r.DataSummaryToggle,{type:"button",onClick:c,"data-expanded":s,className:"inline-flex items-center group gap-2 text-xs text-gray-500 dark:text-white-alpha-600 hover:text-gray-700 dark:hover:text-white-alpha-700 transition-colors cursor-pointer",children:l?e.jsxs(e.Fragment,{children:[e.jsx(a.Check,{className:"check-icon w-3 h-3 text-gray-500 dark:text-white-alpha-500 transition-all duration-200 absolute opacity-100 group-hover:opacity-0 group-data-[expanded=true]:opacity-0"}),e.jsx(a.ChevronRight,{className:"chevron-icon w-3 h-3 text-gray-500 dark:text-white-alpha-500 transition-all duration-200 transform opacity-0 rotate-0 group-hover:opacity-100 group-data-[expanded=true]:opacity-100 group-data-[expanded=true]:rotate-90"}),e.jsx(r.DataSummaryToggleText,{className:"font-medium",children:"Completed"})]}):e.jsxs(e.Fragment,{children:[e.jsx(a.LoaderCircle,{className:"w-3 h-3 animate-spin"}),e.jsx(r.DataSummaryToggleText,{className:"font-medium",children:"Thinking..."})]})}),e.jsx(r.DataSummaryCollapsible,{"data-expanded":s,className:"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(r.DataSummaryList,{className:"pb-2 mt-1.5 space-y-3 relative",children:t.map((o,x)=>e.jsx(p,{summary:o,showConnector:t.length>1&&x<t.length-1},`op-${o.type}-${x}`))})})]})});exports.DataSummaryGroup=g;
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { jsxs as s, jsx as a, Fragment as h } from "react/jsx-runtime";
3
- import { memo as g, useState as u, useEffect as y, useCallback as w, useMemo as n } from "react";
4
- import { Check as f, ChevronRight as N, LoaderCircle as D, CheckCheck as m, Search as S, Dot as k, CircleDot as v, TriangleAlert as b, Download as C, Forward as P, ArrowRight as _, Hammer as d, Brain as T, RefreshCw as I } from "lucide-react";
5
- import { DataSummaryGroup as A, DataSummaryToggle as L, DataSummaryToggleText as p, DataSummaryCollapsible as E, DataSummaryList as M, DataSummaryItem as O, DataSummaryConnector as R, DataSummaryIconContainer as j, DataSummaryContent as G, DataSummaryLabel as z, DataSummaryDetails as F } from "../../primitives/components/data-summaries.js";
3
+ import { memo as g, useState as u, useEffect as y, useCallback as w, useMemo as o } from "react";
4
+ import { Check as f, ChevronRight as N, LoaderCircle as k, CheckCheck as m, Search as D, Dot as S, CircleDot as v, TriangleAlert as b, Download as C, Forward as P, ArrowRight as _, Hammer as d, Brain as T, RefreshCw as I } from "lucide-react";
5
+ import { DataSummaryGroup as A, DataSummaryToggle as L, DataSummaryToggleText as p, DataSummaryCollapsible as O, DataSummaryList as E, DataSummaryItem as M, DataSummaryConnector as R, DataSummaryIconContainer as j, DataSummaryContent as G, DataSummaryLabel as z, DataSummaryDetails as F } from "../../primitives/components/data-summaries.js";
6
6
  const U = (t) => {
7
7
  const { type: r, label: e } = t;
8
8
  return e || r.replace(/_/g, " ").replace(/\b\w/g, (i) => i.toUpperCase());
@@ -18,19 +18,19 @@ const U = (t) => {
18
18
  error: /* @__PURE__ */ a(b, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
19
19
  agent_initializing: /* @__PURE__ */ a(v, { className: "w-3 h-3 animate-spin" }),
20
20
  completion: /* @__PURE__ */ a(m, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
21
- default: /* @__PURE__ */ a(k, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" })
21
+ default: /* @__PURE__ */ a(S, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" })
22
22
  }, x = {
23
- retrieve: /* @__PURE__ */ a(S, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
23
+ retrieve: /* @__PURE__ */ a(D, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
24
24
  action: /* @__PURE__ */ a(m, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
25
25
  ...$
26
26
  }, B = g(({ summary: t, showConnector: r }) => {
27
- const e = n(() => t.details ? JSON.stringify(t.details, null, 2) : null, [t.details]), i = n(() => U(t), [t]), o = n(
27
+ const e = o(() => t.details && Object.keys(t.details).length > 0 ? JSON.stringify(t.details, null, 2) : null, [t.details]), i = o(() => U(t), [t]), n = o(
28
28
  () => x[t.type] || x.default,
29
29
  [t.type]
30
30
  );
31
- return /* @__PURE__ */ s(O, { className: "flex items-start gap-2 text-xs relative", children: [
31
+ return /* @__PURE__ */ s(M, { className: "flex items-start gap-2 text-xs relative", children: [
32
32
  r && /* @__PURE__ */ a(R, { className: "absolute left-1.5 top-4 bottom-0 w-px bg-gray-200 dark:bg-white-alpha-200 -mb-3" }),
33
- /* @__PURE__ */ a(j, { className: "flex items-center justify-center w-3 h-3 relative z-10 mt-0.5", children: o }),
33
+ /* @__PURE__ */ a(j, { className: "flex items-center justify-center w-3 h-3 relative z-10 mt-0.5", children: n }),
34
34
  /* @__PURE__ */ s(G, { className: "flex-1", children: [
35
35
  /* @__PURE__ */ a(z, { className: "text-gray-700 dark:text-white-alpha-600", children: i }),
36
36
  e && /* @__PURE__ */ a(F, { className: "mt-2 text-xs whitespace-pre-wrap font-mono bg-gray-50 dark:bg-gray-dark-900 p-2 rounded-md px-3 py-2", children: e })
@@ -46,7 +46,7 @@ const U = (t) => {
46
46
  l && clearTimeout(l);
47
47
  };
48
48
  }, [r]);
49
- const o = w(() => {
49
+ const n = w(() => {
50
50
  i(!e);
51
51
  }, [e]);
52
52
  return /* @__PURE__ */ s(A, { className: "flex flex-col items-start mb-2.5 mt-2.5 first:mt-1 relative", children: [
@@ -54,7 +54,7 @@ const U = (t) => {
54
54
  L,
55
55
  {
56
56
  type: "button",
57
- onClick: o,
57
+ onClick: n,
58
58
  "data-expanded": e,
59
59
  className: "inline-flex items-center group gap-2 text-xs text-gray-500 dark:text-white-alpha-600 hover:text-gray-700 dark:hover:text-white-alpha-700 transition-colors cursor-pointer",
60
60
  children: r ? /* @__PURE__ */ s(h, { children: [
@@ -62,17 +62,17 @@ const U = (t) => {
62
62
  /* @__PURE__ */ a(N, { className: "chevron-icon w-3 h-3 text-gray-500 dark:text-white-alpha-500 transition-all duration-200 transform opacity-0 rotate-0 group-hover:opacity-100 group-data-[expanded=true]:opacity-100 group-data-[expanded=true]:rotate-90" }),
63
63
  /* @__PURE__ */ a(p, { className: "font-medium", children: "Completed" })
64
64
  ] }) : /* @__PURE__ */ s(h, { children: [
65
- /* @__PURE__ */ a(D, { className: "w-3 h-3 animate-spin" }),
65
+ /* @__PURE__ */ a(k, { className: "w-3 h-3 animate-spin" }),
66
66
  /* @__PURE__ */ a(p, { className: "font-medium", children: "Thinking..." })
67
67
  ] })
68
68
  }
69
69
  ),
70
70
  /* @__PURE__ */ a(
71
- E,
71
+ O,
72
72
  {
73
73
  "data-expanded": e,
74
74
  className: "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",
75
- children: /* @__PURE__ */ a(M, { className: "pb-2 mt-1.5 space-y-3 relative", children: t.map((l, c) => /* @__PURE__ */ a(
75
+ children: /* @__PURE__ */ a(E, { className: "pb-2 mt-1.5 space-y-3 relative", children: t.map((l, c) => /* @__PURE__ */ a(
76
76
  B,
77
77
  {
78
78
  summary: l,
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),A=require("../../primitives/providers/base-events-provider.cjs"),G=require("../../primitives/providers/config-provider.cjs"),K=require("../../primitives/providers/message-provider.cjs"),r=require("../../primitives/components/embedded-chat.cjs"),O=require("../../primitives/components/embedded-chat/chat-provider.cjs"),B=require("merge-anything"),F=require("../utils.cjs"),J=require("./ui/markdown-styles.cjs"),z=require("../../primitives/components/embedded-chat/use-stream-processor.cjs"),H=require("./data-summary-group.cjs"),i=require("react"),Q=require("./embedded-chat.cjs"),k=require("lucide-react"),U=()=>e.jsx("div",{className:"flex space-x-1",children:[0,1,2].map(s=>e.jsx("span",{className:"animate-bounce-dot opacity-30",style:{animationDelay:`${s*.2}s`},children:"."},s))}),w=({name:s,Icon:n,props:y,componentType:p})=>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(n,{className:"w-3 h-3 text-gray-600 dark:text-white-alpha-600"}),e.jsx("span",{children:s})]}),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:p})]}),e.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 font-mono px-4 py-2",children:JSON.stringify(y,null,2)})]}),V=({name:s,props:n})=>e.jsx(w,{name:s,Icon:k.ComponentIcon,props:n,componentType:"component"}),W=({name:s,props:n})=>e.jsx(w,{name:s,Icon:k.Library,props:n,componentType:"artifact"}),X=({className:s,componentStyles:n,children:y,isLast:p,...S})=>{const{message:c}=K.useMessage(),{logEvent:u}=A.useBaseEvents(),{conversationId:C,isStreaming:D,isLoading:q,setError:M}=O.useChat(),{aiChatSettings:{components:N,artifacts:E}}=G.useInkeepConfig(),L=(D||q)&&p&&c.role==="assistant",{processedParts:$,summaryTimings:_,shouldShowInitialLoading:I,shouldShowStreamDelayLoading:T}=z.useStreamProcessor(c.parts,L,M),f=i.useMemo(()=>c.parts.filter(t=>t.type==="data-artifact"&&t.data?.type?.toLowerCase()==="citation"),[c.parts]),b=i.useMemo(()=>B.merge(J.markdownStyles,n??{}),[n]),j=i.useCallback((t,a)=>{u({eventName:"assistant_message_inline_link_opened",properties:{title:a?.toString(),url:t}})},[u]),v=i.useCallback((t,a)=>{u({eventName:"assistant_code_block_copied",properties:{conversationId:C,language:t,code:a}})},[u,C]),P=i.useCallback(t=>e.jsx(r.EmbeddedChatPrimitiveMarkdown,{text:t,componentStyles:b,onLinkClick:j,onCodeCopy:v,artifacts:f}),[b,j,v,f]),R=i.useMemo(()=>F.cn("data-[role=user]:whitespace-pre-wrap mb-3 data-[role=user]:mb-0 [&[data-role=user]>p]:mb-0 max-w-full",s),[s]);return e.jsxs(e.Fragment,{children:[$.map((t,a)=>{const m={"data-role":c.role,"data-type":t?.type==="data-component"?t.data.type:t?.type,...S,className:R};switch(t?.type){case"text":return e.jsx(r.PrimitiveMessagePart,{...m,children:P(t.text||"")},a);case"data-component":{const{type:d}=t.data;switch(d){case"text":return e.jsx("div",{...m,children:P(t.data.text||"")},a);default:{const g=t.data,{name:o,props:x}=g,l=N?.[o],h=l?r.EmbeddedChatPrimitiveDynamicComponent:V;return e.jsx(r.PrimitiveMessagePart,{...m,children:e.jsx(h,{name:o,props:x,componentDef:l})},`${o}-${a}`)}}}case"data-artifact":{const d=t.data,{name:g,type:o,artifactSummary:x}=d,l=E?.[o],h=l?r.EmbeddedChatPrimitiveDynamicComponent:W;return e.jsx(r.PrimitiveMessagePart,{...m,children:e.jsx(h,{name:o,props:x,componentDef:l})},`${g}-${a}`)}case"summary-group":{const d=_.get(t.groupKey)||{isCompleted:!1};return e.jsx(r.PrimitiveMessagePart,{...m,children:e.jsx(H.DataSummaryGroup,{summaries:t.summaries||[],isCompleted:d.isCompleted})},`${t.groupKey}-${a}`)}default:return null}}),I&&e.jsx(Q.MessageLoading,{}),T&&e.jsx(U,{})]})};exports.EmbeddedChatMessagePart=X;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),G=require("../../primitives/providers/base-events-provider.cjs"),K=require("../../primitives/providers/config-provider.cjs"),O=require("../../primitives/providers/message-provider.cjs"),r=require("../../primitives/components/embedded-chat.cjs"),B=require("../../primitives/components/embedded-chat/chat-provider.cjs"),F=require("merge-anything"),J=require("../utils.cjs"),U=require("./ui/markdown-styles.cjs"),z=require("../../primitives/components/embedded-chat/use-stream-processor.cjs"),H=require("./data-summary-group.cjs"),c=require("react"),Q=require("./embedded-chat.cjs"),k=require("lucide-react"),V=()=>e.jsx("div",{className:"flex space-x-1",children:[0,1,2].map(s=>e.jsx("span",{className:"animate-bounce-dot opacity-30",style:{animationDelay:`${s*.2}s`},children:"."},s))}),w=({name:s,Icon:n,props:y,componentType:p})=>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(n,{className:"w-3 h-3 text-gray-600 dark:text-white-alpha-600"}),e.jsx("span",{children:s})]}),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:p})]}),e.jsx("pre",{className:"whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 font-mono px-4 py-2",children:JSON.stringify(y,null,2)})]}),W=({name:s,props:n})=>e.jsx(w,{name:s,Icon:k.ComponentIcon,props:n,componentType:"component"}),X=({name:s,props:n})=>e.jsx(w,{name:s,Icon:k.Library,props:n,componentType:"artifact"}),Y=({className:s,componentStyles:n,children:y,isLast:p,...S})=>{const{message:o}=O.useMessage(),{logEvent:u}=G.useBaseEvents(),{conversationId:C,isStreaming:D,isLoading:M,setError:q}=B.useChat(),{aiChatSettings:{components:N,artifacts:E}}=K.useInkeepConfig(),L=o.role==="user",$=(D||M)&&p&&o.role==="assistant",{processedParts:_,summaryTimings:I,shouldShowInitialLoading:T,shouldShowStreamDelayLoading:R}=z.useStreamProcessor(o.parts,$,q),f=c.useMemo(()=>o.parts.filter(t=>t.type==="data-artifact"&&t.data?.type?.toLowerCase()==="citation"),[o.parts]),b=c.useMemo(()=>F.merge(U.markdownStyles,n??{}),[n]),j=c.useCallback((t,a)=>{u({eventName:"assistant_message_inline_link_opened",properties:{title:a?.toString(),url:t}})},[u]),v=c.useCallback((t,a)=>{u({eventName:"assistant_code_block_copied",properties:{conversationId:C,language:t,code:a}})},[u,C]),P=c.useCallback(t=>e.jsx(r.EmbeddedChatPrimitiveMarkdown,{text:t,componentStyles:b,onLinkClick:j,onCodeCopy:v,artifacts:f}),[b,j,v,f]),A=c.useMemo(()=>J.cn("data-[role=user]:whitespace-pre-wrap mb-3 data-[role=user]:mb-0 [&[data-role=user]>p]:mb-0 max-w-full",s),[s]);return e.jsxs(e.Fragment,{children:[_.map((t,a)=>{const m={"data-role":o.role,"data-type":t?.type==="data-component"?t.data.type:t?.type,...S,className:A};switch(t?.type){case"text":return e.jsx(r.PrimitiveMessagePart,{...m,children:L?t.text:P(t.text||"")},a);case"data-component":{const{type:d}=t.data;switch(d){case"text":return e.jsx("div",{...m,children:P(t.data.text||"")},a);default:{const g=t.data,{name:i,props:x}=g,l=N?.[i],h=l?r.EmbeddedChatPrimitiveDynamicComponent:W;return e.jsx(r.PrimitiveMessagePart,{...m,children:e.jsx(h,{name:i,props:x,componentDef:l})},`${i}-${a}`)}}}case"data-artifact":{const d=t.data,{name:g,type:i,artifactSummary:x}=d,l=E?.[i],h=l?r.EmbeddedChatPrimitiveDynamicComponent:X;return e.jsx(r.PrimitiveMessagePart,{...m,children:e.jsx(h,{name:i,props:x,componentDef:l})},`${g}-${a}`)}case"summary-group":{const d=I.get(t.groupKey)||{isCompleted:!1};return e.jsx(r.PrimitiveMessagePart,{...m,children:e.jsx(H.DataSummaryGroup,{summaries:t.summaries||[],isCompleted:d.isCompleted})},`${t.groupKey}-${a}`)}default:return null}}),T&&e.jsx(Q.MessageLoading,{}),R&&e.jsx(V,{})]})};exports.EmbeddedChatMessagePart=Y;
@@ -1,19 +1,19 @@
1
1
  "use client";
2
- import { jsx as t, jsxs as l, Fragment as G } from "react/jsx-runtime";
3
- import { useBaseEvents as J } from "../../primitives/providers/base-events-provider.js";
4
- import { useInkeepConfig as O } from "../../primitives/providers/config-provider.js";
2
+ import { jsx as t, jsxs as l, Fragment as J } from "react/jsx-runtime";
3
+ import { useBaseEvents as O } from "../../primitives/providers/base-events-provider.js";
4
+ import { useInkeepConfig as U } from "../../primitives/providers/config-provider.js";
5
5
  import { useMessage as q } from "../../primitives/providers/message-provider.js";
6
6
  import { EmbeddedChatPrimitiveMarkdown as z, PrimitiveMessagePart as d, EmbeddedChatPrimitiveDynamicComponent as S } from "../../primitives/components/embedded-chat.js";
7
7
  import { useChat as H } from "../../primitives/components/embedded-chat/chat-provider.js";
8
8
  import { merge as Q } from "merge-anything";
9
9
  import { cn as R } from "../utils.js";
10
- import { markdownStyles as U } from "./ui/markdown-styles.js";
11
- import { useStreamProcessor as V } from "../../primitives/components/embedded-chat/use-stream-processor.js";
12
- import { DataSummaryGroup as W } from "./data-summary-group.js";
10
+ import { markdownStyles as V } from "./ui/markdown-styles.js";
11
+ import { useStreamProcessor as W } from "../../primitives/components/embedded-chat/use-stream-processor.js";
12
+ import { DataSummaryGroup as X } from "./data-summary-group.js";
13
13
  import { useMemo as h, useCallback as y } from "react";
14
- import { MessageLoading as X } from "./embedded-chat.js";
15
- import { Library as Y, ComponentIcon as Z } from "lucide-react";
16
- const ee = () => /* @__PURE__ */ t("div", { className: "flex space-x-1", children: [0, 1, 2].map((a) => /* @__PURE__ */ t(
14
+ import { MessageLoading as Y } from "./embedded-chat.js";
15
+ import { Library as Z, ComponentIcon as ee } from "lucide-react";
16
+ const te = () => /* @__PURE__ */ t("div", { className: "flex space-x-1", children: [0, 1, 2].map((a) => /* @__PURE__ */ t(
17
17
  "span",
18
18
  {
19
19
  className: "animate-bounce-dot opacity-30",
@@ -32,22 +32,22 @@ const ee = () => /* @__PURE__ */ t("div", { className: "flex space-x-1", childre
32
32
  /* @__PURE__ */ t("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: u })
33
33
  ] }),
34
34
  /* @__PURE__ */ t("pre", { className: "whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 font-mono px-4 py-2", children: JSON.stringify(C, null, 2) })
35
- ] }), te = ({ name: a, props: n }) => /* @__PURE__ */ t(N, { name: a, Icon: Z, props: n, componentType: "component" }), ae = ({ name: a, props: n }) => /* @__PURE__ */ t(N, { name: a, Icon: Y, props: n, componentType: "artifact" }), ye = ({
35
+ ] }), ae = ({ name: a, props: n }) => /* @__PURE__ */ t(N, { name: a, Icon: ee, props: n, componentType: "component" }), oe = ({ name: a, props: n }) => /* @__PURE__ */ t(N, { name: a, Icon: Z, props: n, componentType: "artifact" }), Ce = ({
36
36
  className: a,
37
37
  componentStyles: n,
38
38
  children: C,
39
39
  isLast: u,
40
40
  ...L
41
41
  }) => {
42
- const { message: s } = q(), { logEvent: p } = J(), { conversationId: x, isStreaming: M, isLoading: P, setError: E } = H(), {
42
+ const { message: s } = q(), { logEvent: p } = O(), { conversationId: x, isStreaming: M, isLoading: P, setError: E } = H(), {
43
43
  aiChatSettings: { components: _, artifacts: $ }
44
- } = O(), I = (M || P) && u && s.role === "assistant", { processedParts: T, summaryTimings: j, shouldShowInitialLoading: K, shouldShowStreamDelayLoading: A } = V(s.parts, I, E), w = h(
44
+ } = U(), I = s.role === "user", T = (M || P) && u && s.role === "assistant", { processedParts: j, summaryTimings: K, shouldShowInitialLoading: A, shouldShowStreamDelayLoading: B } = W(s.parts, T, E), w = h(
45
45
  () => s.parts.filter(
46
46
  (e) => e.type === "data-artifact" && e.data?.type?.toLowerCase() === "citation"
47
47
  ),
48
48
  [s.parts]
49
49
  ), b = h(
50
- () => Q(U, n ?? {}),
50
+ () => Q(V, n ?? {}),
51
51
  [n]
52
52
  ), k = y(
53
53
  (e, o) => {
@@ -84,48 +84,48 @@ const ee = () => /* @__PURE__ */ t("div", { className: "flex space-x-1", childre
84
84
  }
85
85
  ),
86
86
  [b, k, D, w]
87
- ), B = h(
87
+ ), F = h(
88
88
  () => R(
89
89
  "data-[role=user]:whitespace-pre-wrap mb-3 data-[role=user]:mb-0 [&[data-role=user]>p]:mb-0 max-w-full",
90
90
  a
91
91
  ),
92
92
  [a]
93
93
  );
94
- return /* @__PURE__ */ l(G, { children: [
95
- T.map((e, o) => {
96
- const m = {
94
+ return /* @__PURE__ */ l(J, { children: [
95
+ j.map((e, o) => {
96
+ const i = {
97
97
  "data-role": s.role,
98
98
  "data-type": e?.type === "data-component" ? e.data.type : e?.type,
99
99
  ...L,
100
- className: B
100
+ className: F
101
101
  };
102
102
  switch (e?.type) {
103
103
  case "text":
104
- return /* @__PURE__ */ t(d, { ...m, children: v(e.text || "") }, o);
104
+ return /* @__PURE__ */ t(d, { ...i, children: I ? e.text : v(e.text || "") }, o);
105
105
  case "data-component": {
106
- const { type: i } = e.data;
107
- switch (i) {
106
+ const { type: m } = e.data;
107
+ switch (m) {
108
108
  case "text":
109
- return /* @__PURE__ */ t("div", { ...m, children: v(e.data.text || "") }, o);
109
+ return /* @__PURE__ */ t("div", { ...i, children: v(e.data.text || "") }, o);
110
110
  default: {
111
- const f = e.data, { name: r, props: g } = f, c = _?.[r];
112
- return /* @__PURE__ */ t(d, { ...m, children: /* @__PURE__ */ t(c ? S : te, { name: r, props: g, componentDef: c }) }, `${r}-${o}`);
111
+ const g = e.data, { name: r, props: f } = g, c = _?.[r];
112
+ return /* @__PURE__ */ t(d, { ...i, children: /* @__PURE__ */ t(c ? S : ae, { name: r, props: f, componentDef: c }) }, `${r}-${o}`);
113
113
  }
114
114
  }
115
115
  }
116
116
  case "data-artifact": {
117
- const i = e.data, { name: f, type: r, artifactSummary: g } = i, c = $?.[r];
118
- return /* @__PURE__ */ t(d, { ...m, children: /* @__PURE__ */ t(c ? S : ae, { name: r, props: g, componentDef: c }) }, `${f}-${o}`);
117
+ const m = e.data, { name: g, type: r, artifactSummary: f } = m, c = $?.[r];
118
+ return /* @__PURE__ */ t(d, { ...i, children: /* @__PURE__ */ t(c ? S : oe, { name: r, props: f, componentDef: c }) }, `${g}-${o}`);
119
119
  }
120
120
  case "summary-group": {
121
- const i = j.get(e.groupKey) || {
121
+ const m = K.get(e.groupKey) || {
122
122
  isCompleted: !1
123
123
  };
124
- return /* @__PURE__ */ t(d, { ...m, children: /* @__PURE__ */ t(
125
- W,
124
+ return /* @__PURE__ */ t(d, { ...i, children: /* @__PURE__ */ t(
125
+ X,
126
126
  {
127
127
  summaries: e.summaries || [],
128
- isCompleted: i.isCompleted
128
+ isCompleted: m.isCompleted
129
129
  }
130
130
  ) }, `${e.groupKey}-${o}`);
131
131
  }
@@ -133,10 +133,10 @@ const ee = () => /* @__PURE__ */ t("div", { className: "flex space-x-1", childre
133
133
  return null;
134
134
  }
135
135
  }),
136
- K && /* @__PURE__ */ t(X, {}),
137
- A && /* @__PURE__ */ t(ee, {})
136
+ A && /* @__PURE__ */ t(Y, {}),
137
+ B && /* @__PURE__ */ t(te, {})
138
138
  ] });
139
139
  };
140
140
  export {
141
- ye as EmbeddedChatMessagePart
141
+ Ce as EmbeddedChatMessagePart
142
142
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-ui",
3
- "version": "0.15.1",
3
+ "version": "0.15.2",
4
4
  "description": "",
5
5
  "homepage": "",
6
6
  "repository": {