@inkeep/agents-ui 0.15.8 → 0.15.10

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"),n=require("react"),ee=require("../../providers/config-provider.cjs"),te=require("../../hooks/use-media-query.cjs"),R=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"),oe=require("@radix-ui/react-use-controllable-state"),ae=require("../../hooks/use-streaming-events.cjs"),P=`Hmm..
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ee=require("@ai-sdk/react"),te=require("ai"),n=require("react"),se=require("../../providers/config-provider.cjs"),ne=require("../../hooks/use-media-query.cjs"),A=require("../../utils/generate-uid.cjs"),re=require("../../providers/base-events-provider.cjs"),oe=require("../../providers/chat-form-provider.cjs"),ae=require("../../providers/widget-provider.cjs"),ie=require("@radix-ui/react-use-controllable-state"),ce=require("../../hooks/use-streaming-events.cjs"),P=`Hmm..
2
2
 
3
- It seems I might be having some issues right now. Please clear the chat and try again.`,ie=()=>{const{baseSettings:I,aiChatSettings:i}=ee.useInkeepConfig(),[t="",C]=oe.useControllableState({prop:i.conversationId,defaultProp:i.conversationId??""}),{logEvent:o}=se.useBaseEvents(),{setConversationId:A,emitToParent:u}=ae.useStreamingEvents(),[a,l]=n.useState(""),N=e=>l(e.target.value),{filters:b}=I,{onInputMessageChange:O,filters:y,agentUrl:w,context:m,headers:p,apiKey:d}=i,T=e=>{switch(e.code){case 400:return e.message;case 403:return`There seems to be a configuration error. Please contact ${I.organizationDisplayName??"Administrator"}`;default:return P}},[U,g]=n.useState([]),[z,M]=n.useState(null),H=n.useMemo(()=>new Y.DefaultChatTransport({api:w,headers:{...d?{Authorization:`Bearer ${d}`}:{},"x-inkeep-client-timezone":Intl.DateTimeFormat().resolvedOptions().timeZone,"x-inkeep-client-timestamp":new Date().toISOString(),...p},body:{requestContext:m}}),[w,d,p,m]),{messages:h,sendMessage:K,status:_,setMessages:q,stop:L,error:f}=X.useChat({transport:H,onData(e){u(e.type,e.data)},async onFinish(){u("completion",{conversationId:t}),await o({eventName:"assistant_message_received",properties:{conversationId:t}}),o({eventName:"assistant_answer_displayed",properties:{conversationId:t}})},onError(e){console.log("onError",e.message),o({eventName:"chat_error",properties:{conversationId:t,error:e.message}}),q(c=>{const r=[...c],s=r[r.length-1];if(s){const F=T(e);s.role==="user"?r.push({id:R.generateUid(16),role:"assistant",parts:[{type:"text",text:F}]}):s.parts=[{type:"text",text:F}]}return r})}}),x=_==="submitted",W=_==="streaming",$=h.length===0,v=!a.trim()||x,B=te.useMediaQuery("(max-width: 768px)"),[G,S]=n.useState(null);n.useEffect(()=>{f&&S(f)},[f]);const Q=()=>S(null),k=n.useRef(null);n.useEffect(()=>{O?.(a)},[a]);const Z=e=>{e.key==="Enter"&&!e.shiftKey&&!v&&!e.nativeEvent.isComposing&&(e.preventDefault(),E())},E=async(e=a)=>{if(v&&(!e||e.trim().length===0))return;g([]),l(""),await o({eventName:"user_message_submitted",properties:{conversationId:t}});const c=b||y?JSON.stringify({...b,...y}):void 0,r={...p};c&&(r["inkeep-filters"]=c);let s=t;s||(s=`conv_${R.generateUid(16)}`,C(s)),A(s),K({text:e},{headers:{"x-inkeep-client-timezone":Intl.DateTimeFormat().resolvedOptions().timeZone,"x-inkeep-client-timestamp":new Date().toISOString(),...r},body:{conversationId:s,requestContext:m}})},j=()=>{L().then(()=>{u("aborted",{conversationId:t})})},D=()=>{Q(),q([]),C(""),g([]),M(null),o({eventName:"chat_clear_button_clicked",properties:{conversationId:t}})},{openForm:J}=ne.useChatForm(),V=re.useWidget();return n.useImperativeHandle(i.chatFunctionsRef,()=>({submitMessage:E,updateInputMessage(e){l(e)},clearChat:D,openForm:e=>{V?.setView("chat"),J(e,void 0)},focusInput:()=>{k.current?.focus()}})),{messages:h,isLoading:x,isStreaming:W,error:G,setError:S,isSubmitDisabled:v,input:a,handleInputChange:N,handleInputKeyDown:Z,handleSubmit:E,stop:j,clear:D,isEmpty:h.length===0,inputRef:k,isMobile:B,messageAttachments:U,setMessageAttachments:g,selectedWorkflow:z,setSelectedWorkflow:M,isNewChat:$,conversationId:t}};exports.DEFAULT_ERROR_MESSAGE=P;exports.useInkeepChat=ie;
3
+ It seems I might be having some issues right now. Please clear the chat and try again.`,ue=()=>{const{baseSettings:C,aiChatSettings:i}=se.useInkeepConfig(),[t="",I]=ie.useControllableState({prop:i.conversationId,defaultProp:i.conversationId??""}),{logEvent:o}=re.useBaseEvents(),{setConversationId:N,emitToParent:u}=ce.useStreamingEvents(),[a,l]=n.useState(""),T=e=>l(e.target.value),{filters:b}=C,{onInputMessageChange:U,filters:y,agentUrl:w,context:d,headers:p,apiKey:g}=i,O=e=>{switch(e.code){case 400:return e.message;case 403:return`There seems to be a configuration error. Please contact ${C.organizationDisplayName??"Administrator"}`;default:return P}},[H,m]=n.useState([]),[z,M]=n.useState(null),K=()=>({"x-inkeep-client-timezone":Intl.DateTimeFormat().resolvedOptions().timeZone,"x-inkeep-client-timestamp":new Date().toISOString()}),L=n.useMemo(()=>new te.DefaultChatTransport({api:w,headers:{...g?{Authorization:`Bearer ${g}`}:{},...p},body:{requestContext:d}}),[w,g,p,d]),{messages:h,sendMessage:_,addToolApprovalResponse:W,status:q,setMessages:x,stop:$,error:f}=ee.useChat({transport:L,onData(e){u(e.type,e.data)},async onFinish(){u("completion",{conversationId:t}),await o({eventName:"assistant_message_received",properties:{conversationId:t}}),o({eventName:"assistant_answer_displayed",properties:{conversationId:t}})},onError(e){console.log("onError",e.message),o({eventName:"chat_error",properties:{conversationId:t,error:e.message}}),x(c=>{const r=[...c],s=r[r.length-1];if(s){const D=O(e);s.role==="user"?r.push({id:A.generateUid(16),role:"assistant",parts:[{type:"text",text:D}]}):s.parts=[{type:"text",text:D}]}return r})}}),F=q==="submitted",B=q==="streaming",G=h.length===0,v=!a.trim()||F,Q=ne.useMediaQuery("(max-width: 768px)"),[j,S]=n.useState(null);n.useEffect(()=>{f&&S(f)},[f]);const J=()=>S(null),R=n.useRef(null);n.useEffect(()=>{U?.(a)},[a]);const V=e=>{e.key==="Enter"&&!e.shiftKey&&!v&&!e.nativeEvent.isComposing&&(e.preventDefault(),E())},E=async(e=a)=>{if(v&&(!e||e.trim().length===0))return;m([]),l(""),await o({eventName:"user_message_submitted",properties:{conversationId:t}});const c=b||y?JSON.stringify({...b,...y}):void 0,r={...p};c&&(r["inkeep-filters"]=c);let s=t;s||(s=`conv_${A.generateUid(16)}`,I(s)),N(s),_({text:e},{headers:{...K(),...r},body:{conversationId:s,requestContext:d}})},Z=()=>{$().then(()=>{u("aborted",{conversationId:t})})},k=()=>{J(),x([]),I(""),m([]),M(null),o({eventName:"chat_clear_button_clicked",properties:{conversationId:t}})},{openForm:X}=oe.useChatForm(),Y=ae.useWidget();return n.useImperativeHandle(i.chatFunctionsRef,()=>({submitMessage:E,updateInputMessage(e){l(e)},clearChat:k,openForm:e=>{Y?.setView("chat"),X(e,void 0)},focusInput:()=>{R.current?.focus()}})),{messages:h,sendMessage:_,addToolApprovalResponse:W,isLoading:F,isStreaming:B,error:j,setError:S,isSubmitDisabled:v,input:a,handleInputChange:T,handleInputKeyDown:V,handleSubmit:E,stop:Z,clear:k,isEmpty:h.length===0,inputRef:R,isMobile:Q,messageAttachments:H,setMessageAttachments:m,selectedWorkflow:z,setSelectedWorkflow:M,isNewChat:G,conversationId:t}};exports.DEFAULT_ERROR_MESSAGE=P;exports.useInkeepChat=ue;
@@ -1,8 +1,29 @@
1
1
  import { KeyboardEvent, Dispatch, SetStateAction, RefObject } from 'react';
2
2
  import { Message, MessageAttachment, Workflow } from '../../../types/index.ts';
3
+ import { FileUIPart, ChatRequestOptions, ChatAddToolApproveResponseFunction } from 'ai';
3
4
  export declare const DEFAULT_ERROR_MESSAGE = "Hmm.. \n\nIt seems I might be having some issues right now. Please clear the chat and try again.";
4
5
  export declare const useInkeepChat: () => {
5
6
  messages: Message[];
7
+ sendMessage: (message?: (Omit<Message, "id" | "role"> & {
8
+ id?: string | undefined;
9
+ role?: "system" | "user" | "assistant" | undefined;
10
+ } & {
11
+ text?: never;
12
+ files?: never;
13
+ messageId?: string;
14
+ }) | {
15
+ text: string;
16
+ files?: FileList | FileUIPart[];
17
+ metadata?: unknown;
18
+ parts?: never;
19
+ messageId?: string;
20
+ } | {
21
+ files: FileList | FileUIPart[];
22
+ metadata?: unknown;
23
+ parts?: never;
24
+ messageId?: string;
25
+ } | undefined, options?: ChatRequestOptions) => Promise<void>;
26
+ addToolApprovalResponse: ChatAddToolApproveResponseFunction;
6
27
  isLoading: boolean;
7
28
  isStreaming: boolean;
8
29
  error: Error | null;
@@ -1,68 +1,70 @@
1
1
  "use client";
2
- import { useChat as X } from "@ai-sdk/react";
3
- import { DefaultChatTransport as Y } from "ai";
4
- import { useState as m, useMemo as ee, useEffect as A, 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 O } 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 me } from "@radix-ui/react-use-controllable-state";
12
- import { useStreamingEvents as ce } from "../../hooks/use-streaming-events.js";
13
- const le = `Hmm..
2
+ import { useChat as ee } from "@ai-sdk/react";
3
+ import { DefaultChatTransport as te } from "ai";
4
+ import { useState as c, useMemo as se, useEffect as R, useRef as ne, useImperativeHandle as oe } from "react";
5
+ import { useInkeepConfig as re } from "../../providers/config-provider.js";
6
+ import { useMediaQuery as ae } from "../../hooks/use-media-query.js";
7
+ import { generateUid as T } from "../../utils/generate-uid.js";
8
+ import { useBaseEvents as ie } from "../../providers/base-events-provider.js";
9
+ import { useChatForm as ce } from "../../providers/chat-form-provider.js";
10
+ import { useWidget as me } from "../../providers/widget-provider.js";
11
+ import { useControllableState as le } from "@radix-ui/react-use-controllable-state";
12
+ import { useStreamingEvents as pe } from "../../hooks/use-streaming-events.js";
13
+ const ue = `Hmm..
14
14
 
15
- It seems I might be having some issues right now. Please clear the chat and try again.`, Ee = () => {
16
- const { baseSettings: S, aiChatSettings: a } = ne(), [t = "", y] = me({
15
+ It seems I might be having some issues right now. Please clear the chat and try again.`, we = () => {
16
+ const { baseSettings: y, aiChatSettings: a } = re(), [t = "", E] = le({
17
17
  prop: a.conversationId,
18
18
  defaultProp: a.conversationId ?? ""
19
- }), { logEvent: o } = re(), { setConversationId: R, emitToParent: c } = ce(), [r, l] = m(""), T = (e) => l(e.target.value), {
19
+ }), { logEvent: o } = ie(), { setConversationId: H, emitToParent: m } = pe(), [r, l] = c(""), O = (e) => l(e.target.value), {
20
20
  /* shouldBypassCaptcha, */
21
- filters: E
22
- } = S, {
23
- onInputMessageChange: z,
24
- filters: b,
21
+ filters: b
22
+ } = y, {
23
+ onInputMessageChange: P,
24
+ filters: S,
25
25
  agentUrl: w,
26
26
  context: p,
27
27
  headers: u,
28
- apiKey: g
29
- } = a, P = (e) => {
28
+ apiKey: d
29
+ } = a, q = (e) => {
30
30
  switch (e.code) {
31
31
  case 400:
32
32
  return e.message;
33
33
  case 403:
34
- return `There seems to be a configuration error. Please contact ${S.organizationDisplayName ?? "Administrator"}`;
34
+ return `There seems to be a configuration error. Please contact ${y.organizationDisplayName ?? "Administrator"}`;
35
35
  default:
36
- return le;
36
+ return ue;
37
37
  }
38
- }, [q, d] = m([]), [H, x] = m(null), K = ee(
39
- () => new Y({
38
+ }, [z, g] = c([]), [K, x] = c(null), U = () => ({
39
+ "x-inkeep-client-timezone": Intl.DateTimeFormat().resolvedOptions().timeZone,
40
+ "x-inkeep-client-timestamp": (/* @__PURE__ */ new Date()).toISOString()
41
+ }), W = se(
42
+ () => new te({
40
43
  api: w,
41
44
  headers: {
42
- ...g ? { Authorization: `Bearer ${g}` } : {},
43
- "x-inkeep-client-timezone": Intl.DateTimeFormat().resolvedOptions().timeZone,
44
- "x-inkeep-client-timestamp": (/* @__PURE__ */ new Date()).toISOString(),
45
+ ...d ? { Authorization: `Bearer ${d}` } : {},
45
46
  ...u
46
47
  },
47
48
  body: {
48
49
  requestContext: p
49
50
  }
50
51
  }),
51
- [w, g, u, p]
52
+ [w, d, u, p]
52
53
  ), {
53
54
  messages: h,
54
- sendMessage: U,
55
- status: M,
56
- setMessages: _,
57
- stop: W,
55
+ sendMessage: M,
56
+ addToolApprovalResponse: $,
57
+ status: _,
58
+ setMessages: k,
59
+ stop: B,
58
60
  error: f
59
- } = X({
60
- transport: K,
61
+ } = ee({
62
+ transport: W,
61
63
  onData(e) {
62
- c(e.type, e.data);
64
+ m(e.type, e.data);
63
65
  },
64
66
  async onFinish() {
65
- c("completion", { conversationId: t }), await o({
67
+ m("completion", { conversationId: t }), await o({
66
68
  eventName: "assistant_message_received",
67
69
  properties: {
68
70
  conversationId: t
@@ -81,53 +83,52 @@ It seems I might be having some issues right now. Please clear the chat and try
81
83
  conversationId: t,
82
84
  error: e.message
83
85
  }
84
- }), _((i) => {
86
+ }), k((i) => {
85
87
  const n = [...i], s = n[n.length - 1];
86
88
  if (s) {
87
- const N = P(e);
89
+ const A = q(e);
88
90
  s.role === "user" ? n.push({
89
- id: O(16),
91
+ id: T(16),
90
92
  role: "assistant",
91
- parts: [{ type: "text", text: N }]
92
- }) : s.parts = [{ type: "text", text: N }];
93
+ parts: [{ type: "text", text: A }]
94
+ }) : s.parts = [{ type: "text", text: A }];
93
95
  }
94
96
  return n;
95
97
  });
96
98
  }
97
- }), k = M === "submitted", $ = M === "streaming", B = h.length === 0, v = !r.trim() || k, L = oe("(max-width: 768px)"), [Z, I] = m(null);
98
- A(() => {
99
+ }), D = _ === "submitted", L = _ === "streaming", G = h.length === 0, v = !r.trim() || D, J = ae("(max-width: 768px)"), [Q, I] = c(null);
100
+ R(() => {
99
101
  f && I(f);
100
102
  }, [f]);
101
- const G = () => I(null), D = te(null);
102
- A(() => {
103
- z?.(r);
103
+ const V = () => I(null), F = ne(null);
104
+ R(() => {
105
+ P?.(r);
104
106
  }, [r]);
105
- const J = (e) => {
107
+ const Z = (e) => {
106
108
  e.key === "Enter" && !e.shiftKey && !v && !e.nativeEvent.isComposing && (e.preventDefault(), C());
107
109
  }, C = async (e = r) => {
108
110
  if (v && (!e || e.trim().length === 0)) return;
109
- d([]), l(""), await o({
111
+ g([]), l(""), await o({
110
112
  eventName: "user_message_submitted",
111
113
  properties: {
112
114
  conversationId: t
113
115
  }
114
116
  });
115
- const i = E || b ? JSON.stringify({
116
- ...E,
117
- ...b
117
+ const i = b || S ? JSON.stringify({
118
+ ...b,
119
+ ...S
118
120
  }) : void 0, n = {
119
121
  ...u
120
122
  };
121
123
  i && (n["inkeep-filters"] = i);
122
124
  let s = t;
123
- s || (s = `conv_${O(16)}`, y(s)), R(s), U(
125
+ s || (s = `conv_${T(16)}`, E(s)), H(s), M(
124
126
  {
125
127
  text: e
126
128
  },
127
129
  {
128
130
  headers: {
129
- "x-inkeep-client-timezone": Intl.DateTimeFormat().resolvedOptions().timeZone,
130
- "x-inkeep-client-timestamp": (/* @__PURE__ */ new Date()).toISOString(),
131
+ ...U(),
131
132
  ...n
132
133
  },
133
134
  body: {
@@ -136,56 +137,58 @@ It seems I might be having some issues right now. Please clear the chat and try
136
137
  }
137
138
  }
138
139
  );
139
- }, Q = () => {
140
- W().then(() => {
141
- c("aborted", { conversationId: t });
140
+ }, j = () => {
141
+ B().then(() => {
142
+ m("aborted", { conversationId: t });
142
143
  });
143
- }, F = () => {
144
- G(), _([]), y(""), d([]), x(null), o({
144
+ }, N = () => {
145
+ V(), k([]), E(""), g([]), x(null), o({
145
146
  eventName: "chat_clear_button_clicked",
146
147
  properties: {
147
148
  conversationId: t
148
149
  }
149
150
  });
150
- }, { openForm: V } = ae(), j = ie();
151
- return se(a.chatFunctionsRef, () => ({
151
+ }, { openForm: X } = ce(), Y = me();
152
+ return oe(a.chatFunctionsRef, () => ({
152
153
  submitMessage: C,
153
154
  updateInputMessage(e) {
154
155
  l(e);
155
156
  },
156
- clearChat: F,
157
+ clearChat: N,
157
158
  openForm: (e) => {
158
- j?.setView("chat"), V(e, void 0);
159
+ Y?.setView("chat"), X(e, void 0);
159
160
  },
160
161
  focusInput: () => {
161
- D.current?.focus();
162
+ F.current?.focus();
162
163
  }
163
164
  })), {
164
165
  messages: h,
165
- isLoading: k,
166
- isStreaming: $,
167
- error: Z,
166
+ sendMessage: M,
167
+ addToolApprovalResponse: $,
168
+ isLoading: D,
169
+ isStreaming: L,
170
+ error: Q,
168
171
  setError: I,
169
172
  isSubmitDisabled: v,
170
173
  input: r,
171
- handleInputChange: T,
172
- handleInputKeyDown: J,
174
+ handleInputChange: O,
175
+ handleInputKeyDown: Z,
173
176
  handleSubmit: C,
174
- stop: Q,
175
- clear: F,
177
+ stop: j,
178
+ clear: N,
176
179
  isEmpty: h.length === 0,
177
- inputRef: D,
178
- isMobile: L,
180
+ inputRef: F,
181
+ isMobile: J,
179
182
  // Additional state for attachments and workflow
180
- messageAttachments: q,
181
- setMessageAttachments: d,
182
- selectedWorkflow: H,
183
+ messageAttachments: z,
184
+ setMessageAttachments: g,
185
+ selectedWorkflow: K,
183
186
  setSelectedWorkflow: x,
184
- isNewChat: B,
187
+ isNewChat: G,
185
188
  conversationId: t
186
189
  };
187
190
  };
188
191
  export {
189
- le as DEFAULT_ERROR_MESSAGE,
190
- Ee as useInkeepChat
192
+ ue as DEFAULT_ERROR_MESSAGE,
193
+ we as useInkeepChat
191
194
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),E=require("./use-inkeep-chat.cjs");function L(f,u,d){const[p,D]=n.useState([]),[h,w]=n.useState(new Map),[C,T]=n.useState(Date.now()),[A,y]=n.useState(!1),x=n.useRef(0),S=n.useRef(0),R=n.useRef([]),m=n.useRef(h);m.current=h;const b=n.useCallback(()=>{const t=[];let e="",a=[],i=!1;f.length>x.current&&(T(Date.now()),x.current=f.length),S.current=0;const c=new Map,l=(s=!1)=>{if(a.length>0){const r=`group-${S.current++}`,o=m.current.get(r);o?c.set(r,{...o,isCompleted:s}):c.set(r,{isCompleted:s}),t.push({type:"summary-group",summaries:[...a],groupKey:r}),a=[]}};for(const s of f)if(s.type==="text")l(!0),e+=s.text||"";else if(s.type==="data-summary")e.trim()&&(t.push({type:"text",text:e}),e=""),a.push(s.data);else if(s.type==="data-operation"){e.trim()&&(t.push({type:"text",text:e}),e="");const r=s.data;if(r?.type)switch(r.type){case"agent_initializing":break;case"completion":{const{type:o}=r;a.push({type:o,label:"Completed"}),l(!0);break}case"error":{const o=r.message||"Unknown error";if(console.warn("Data operation error:",o),!t.length)l(!0),d(new Error(o)),i||(t.push({type:"text",text:E.DEFAULT_ERROR_MESSAGE}),i=!0);else{const{type:g,label:v}=r;a.push({type:g,label:v})}break}default:{const{type:o,label:g}=r;a.push({type:o,label:g});break}}}else if(s.type==="data-artifact")if(s.data?.type?.toLowerCase()==="citation"){const r=s.data,o=r.artifactSummary||{title:r.name};e+=` ^${o?.title||r.name}^`}else e.trim()&&(t.push({type:"text",text:e}),e=""),t.push(s);else s.type==="data-component"&&(e.trim()&&(t.push({type:"text",text:e}),e=""),l(!0),t.push(s));return l(!u),e.trim()&&t.push({type:"text",text:e}),{processed:t,newTimings:c}},[f,u,d]);n.useEffect(()=>{if(R.current===f)return;R.current=f;const{processed:t,newTimings:e}=b();D(t),(e.size!==m.current.size||Array.from(e.entries()).some(([i,c])=>{const l=m.current.get(i);return!l||l.isCompleted!==c.isCompleted}))&&w(e)},[b,f]),n.useEffect(()=>{u||w(t=>{const e=new Map(t);let a=!1;for(const[i,c]of e.entries())c.isCompleted||(e.set(i,{...c,isCompleted:!0}),a=!0);return a?e:t})},[u]);const k=n.useCallback(()=>{const t=Date.now()-C,e=Array.from(m.current.values()).some(i=>!i.isCompleted),a=t>1e3&&!e;y(a)},[C]);n.useEffect(()=>{if(!u){y(!1);return}if(!(p.length>0)){y(!1);return}const e=setInterval(k,200);return()=>clearInterval(e)},[u,k,p.length]);const P=n.useMemo(()=>!!(!(p.length>0)&&u),[p.length,u]);return{processedParts:p,summaryTimings:h,shouldShowInitialLoading:P,shouldShowStreamDelayLoading:A}}exports.useStreamProcessor=L;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),L=require("./use-inkeep-chat.cjs");function M(l,u,C){const[p,k]=r.useState([]),[y,x]=r.useState(new Map),[w,A]=r.useState(Date.now()),[P,d]=r.useState(!1),S=r.useRef(0),D=r.useRef(0),R=r.useRef([]),m=r.useRef(y);m.current=y;const T=r.useCallback(()=>{const t=[];let e="",o=[],i=!1;l.length>S.current&&(A(Date.now()),S.current=l.length),D.current=0;const c=new Map,a=(n=!1)=>{if(o.length>0){const s=`group-${D.current++}`,h=m.current.get(s);h?c.set(s,{...h,isCompleted:n}):c.set(s,{isCompleted:n}),t.push({type:"summary-group",summaries:[...o],groupKey:s}),o=[]}};for(const n of l)if(n.type==="text")a(!0),e+=n.text||"";else if(n.type==="data-summary")e.trim()&&(t.push({type:"text",text:e}),e=""),o.push(n.data);else if(n.type==="data-operation"){e.trim()&&(t.push({type:"text",text:e}),e="");const s=n.data;if(s?.type){if((s.type==="tool_call"||s.type==="tool_result")&&s.details?.data?.inDelegatedAgent===!1)continue;switch(s.type){case"agent_initializing":break;case"completion":{const{type:f}=s;o.push({type:f,label:"Completed"}),a(!0);break}case"error":{const f=s.message||"Unknown error";if(console.warn("Data operation error:",f),!t.length)a(!0),C(new Error(f)),i||(t.push({type:"text",text:L.DEFAULT_ERROR_MESSAGE}),i=!0);else{const{type:g,label:E}=s;o.push({type:g,label:E})}break}default:{const{type:f,label:g}=s;o.push({type:f,label:g});break}}}}else if(n.type==="data-artifact")if(n.data?.type?.toLowerCase()==="citation"){const s=n.data,h=s.artifactSummary||{title:s.name};e+=` ^${h?.title||s.name}^`}else e.trim()&&(t.push({type:"text",text:e}),e=""),t.push(n);else n.type==="data-component"?(e.trim()&&(t.push({type:"text",text:e}),e=""),a(!0),t.push(n)):(e.trim()&&(t.push({type:"text",text:e}),e=""),a(!0),t.push(n));return a(!u),e.trim()&&t.push({type:"text",text:e}),{processed:t,newTimings:c}},[l,u,C]);r.useEffect(()=>{if(R.current===l)return;R.current=l;const{processed:t,newTimings:e}=T();k(t),(e.size!==m.current.size||Array.from(e.entries()).some(([i,c])=>{const a=m.current.get(i);return!a||a.isCompleted!==c.isCompleted}))&&x(e)},[T,l]),r.useEffect(()=>{u||x(t=>{const e=new Map(t);let o=!1;for(const[i,c]of e.entries())c.isCompleted||(e.set(i,{...c,isCompleted:!0}),o=!0);return o?e:t})},[u]);const b=r.useCallback(()=>{const t=Date.now()-w,e=Array.from(m.current.values()).some(i=>!i.isCompleted),o=t>1e3&&!e;d(o)},[w]);r.useEffect(()=>{if(!u){d(!1);return}if(!(p.length>0)){d(!1);return}const e=setInterval(b,200);return()=>clearInterval(e)},[u,b,p.length]);const v=r.useMemo(()=>!!(!(p.length>0)&&u),[p.length,u]);return{processedParts:p,summaryTimings:y,shouldShowInitialLoading:v,shouldShowStreamDelayLoading:P}}exports.useStreamProcessor=M;
@@ -1,119 +1,122 @@
1
1
  "use client";
2
- import { useState as m, useRef as h, useCallback as L, useEffect as w, useMemo as z } from "react";
2
+ import { useState as h, useRef as y, useCallback as R, useEffect as w, useMemo as z } from "react";
3
3
  import { DEFAULT_ERROR_MESSAGE as G } from "./use-inkeep-chat.js";
4
- function F(l, a, x) {
5
- const [f, R] = m([]), [y, C] = m(/* @__PURE__ */ new Map()), [D, v] = m(Date.now()), [M, g] = m(!1), S = h(0), A = h(0), T = h([]), p = h(y);
6
- p.current = y;
7
- const b = L(() => {
8
- const e = [];
9
- let t = "", n = [], i = !1;
10
- l.length > S.current && (v(Date.now()), S.current = l.length), A.current = 0;
11
- const c = /* @__PURE__ */ new Map(), u = (s = !1) => {
12
- if (n.length > 0) {
13
- const r = `group-${A.current++}`, o = p.current.get(r);
14
- o ? c.set(r, {
15
- ...o,
16
- isCompleted: s
17
- }) : c.set(r, {
18
- isCompleted: s
19
- }), e.push({
4
+ function K(c, a, C) {
5
+ const [p, v] = h([]), [d, D] = h(/* @__PURE__ */ new Map()), [T, M] = h(Date.now()), [P, g] = h(!1), A = y(0), S = y(0), b = y([]), f = y(d);
6
+ f.current = d;
7
+ const k = R(() => {
8
+ const t = [];
9
+ let e = "", r = [], i = !1;
10
+ c.length > A.current && (M(Date.now()), A.current = c.length), S.current = 0;
11
+ const u = /* @__PURE__ */ new Map(), o = (n = !1) => {
12
+ if (r.length > 0) {
13
+ const s = `group-${S.current++}`, m = f.current.get(s);
14
+ m ? u.set(s, {
15
+ ...m,
16
+ isCompleted: n
17
+ }) : u.set(s, {
18
+ isCompleted: n
19
+ }), t.push({
20
20
  type: "summary-group",
21
- summaries: [...n],
22
- groupKey: r
23
- }), n = [];
21
+ summaries: [...r],
22
+ groupKey: s
23
+ }), r = [];
24
24
  }
25
25
  };
26
- for (const s of l)
27
- if (s.type === "text")
28
- u(!0), t += s.text || "";
29
- else if (s.type === "data-summary")
30
- t.trim() && (e.push({ type: "text", text: t }), t = ""), n.push(s.data);
31
- else if (s.type === "data-operation") {
32
- t.trim() && (e.push({ type: "text", text: t }), t = "");
33
- const r = s.data;
34
- if (r?.type)
35
- switch (r.type) {
26
+ for (const n of c)
27
+ if (n.type === "text")
28
+ o(!0), e += n.text || "";
29
+ else if (n.type === "data-summary")
30
+ e.trim() && (t.push({ type: "text", text: e }), e = ""), r.push(n.data);
31
+ else if (n.type === "data-operation") {
32
+ e.trim() && (t.push({ type: "text", text: e }), e = "");
33
+ const s = n.data;
34
+ if (s?.type) {
35
+ if ((s.type === "tool_call" || s.type === "tool_result") && s.details?.data?.inDelegatedAgent === !1)
36
+ continue;
37
+ switch (s.type) {
36
38
  case "agent_initializing":
37
39
  break;
38
40
  case "completion": {
39
- const { type: o } = r;
40
- n.push({ type: o, label: "Completed" }), u(!0);
41
+ const { type: l } = s;
42
+ r.push({ type: l, label: "Completed" }), o(!0);
41
43
  break;
42
44
  }
43
45
  case "error": {
44
- const o = r.message || "Unknown error";
45
- if (console.warn("Data operation error:", o), !e.length)
46
- u(!0), x(new Error(o)), i || (e.push({ type: "text", text: G }), i = !0);
46
+ const l = s.message || "Unknown error";
47
+ if (console.warn("Data operation error:", l), !t.length)
48
+ o(!0), C(new Error(l)), i || (t.push({ type: "text", text: G }), i = !0);
47
49
  else {
48
- const { type: d, label: E } = r;
49
- n.push({ type: d, label: E });
50
+ const { type: x, label: _ } = s;
51
+ r.push({ type: x, label: _ });
50
52
  }
51
53
  break;
52
54
  }
53
55
  default: {
54
- const { type: o, label: d } = r;
55
- n.push({ type: o, label: d });
56
+ const { type: l, label: x } = s;
57
+ r.push({ type: l, label: x });
56
58
  break;
57
59
  }
58
60
  }
59
- } else if (s.type === "data-artifact")
60
- if (s.data?.type?.toLowerCase() === "citation") {
61
- const r = s.data, o = r.artifactSummary || {
62
- title: r.name
61
+ }
62
+ } else if (n.type === "data-artifact")
63
+ if (n.data?.type?.toLowerCase() === "citation") {
64
+ const s = n.data, m = s.artifactSummary || {
65
+ title: s.name
63
66
  };
64
- t += ` ^${o?.title || r.name}^`;
67
+ e += ` ^${m?.title || s.name}^`;
65
68
  } else
66
- t.trim() && (e.push({ type: "text", text: t }), t = ""), e.push(s);
67
- else s.type === "data-component" && (t.trim() && (e.push({ type: "text", text: t }), t = ""), u(!0), e.push(s));
68
- return u(!a), t.trim() && e.push({ type: "text", text: t }), { processed: e, newTimings: c };
69
- }, [l, a, x]);
69
+ e.trim() && (t.push({ type: "text", text: e }), e = ""), t.push(n);
70
+ else n.type === "data-component" ? (e.trim() && (t.push({ type: "text", text: e }), e = ""), o(!0), t.push(n)) : (e.trim() && (t.push({ type: "text", text: e }), e = ""), o(!0), t.push(n));
71
+ return o(!a), e.trim() && t.push({ type: "text", text: e }), { processed: t, newTimings: u };
72
+ }, [c, a, C]);
70
73
  w(() => {
71
- if (T.current === l)
74
+ if (b.current === c)
72
75
  return;
73
- T.current = l;
74
- const { processed: e, newTimings: t } = b();
75
- R(e), (t.size !== p.current.size || Array.from(t.entries()).some(([i, c]) => {
76
- const u = p.current.get(i);
77
- return !u || u.isCompleted !== c.isCompleted;
78
- })) && C(t);
79
- }, [b, l]), w(() => {
80
- a || C((e) => {
81
- const t = new Map(e);
82
- let n = !1;
83
- for (const [i, c] of t.entries())
84
- c.isCompleted || (t.set(i, {
85
- ...c,
76
+ b.current = c;
77
+ const { processed: t, newTimings: e } = k();
78
+ v(t), (e.size !== f.current.size || Array.from(e.entries()).some(([i, u]) => {
79
+ const o = f.current.get(i);
80
+ return !o || o.isCompleted !== u.isCompleted;
81
+ })) && D(e);
82
+ }, [k, c]), w(() => {
83
+ a || D((t) => {
84
+ const e = new Map(t);
85
+ let r = !1;
86
+ for (const [i, u] of e.entries())
87
+ u.isCompleted || (e.set(i, {
88
+ ...u,
86
89
  isCompleted: !0
87
- }), n = !0);
88
- return n ? t : e;
90
+ }), r = !0);
91
+ return r ? e : t;
89
92
  });
90
93
  }, [a]);
91
- const k = L(() => {
92
- const e = Date.now() - D, t = Array.from(p.current.values()).some(
94
+ const L = R(() => {
95
+ const t = Date.now() - T, e = Array.from(f.current.values()).some(
93
96
  (i) => !i.isCompleted
94
- ), n = e > 1e3 && !t;
95
- g(n);
96
- }, [D]);
97
+ ), r = t > 1e3 && !e;
98
+ g(r);
99
+ }, [T]);
97
100
  w(() => {
98
101
  if (!a) {
99
102
  g(!1);
100
103
  return;
101
104
  }
102
- if (!(f.length > 0)) {
105
+ if (!(p.length > 0)) {
103
106
  g(!1);
104
107
  return;
105
108
  }
106
- const t = setInterval(k, 200);
107
- return () => clearInterval(t);
108
- }, [a, k, f.length]);
109
- const P = z(() => !!(!(f.length > 0) && a), [f.length, a]);
109
+ const e = setInterval(L, 200);
110
+ return () => clearInterval(e);
111
+ }, [a, L, p.length]);
112
+ const E = z(() => !!(!(p.length > 0) && a), [p.length, a]);
110
113
  return {
111
- processedParts: f,
112
- summaryTimings: y,
113
- shouldShowInitialLoading: P,
114
- shouldShowStreamDelayLoading: M
114
+ processedParts: p,
115
+ summaryTimings: d,
116
+ shouldShowInitialLoading: E,
117
+ shouldShowStreamDelayLoading: P
115
118
  };
116
119
  }
117
120
  export {
118
- F as useStreamProcessor
121
+ K as useStreamProcessor
119
122
  };
@@ -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.7",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.9",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.7",
8
+ widgetLibraryVersion: "0.15.9",
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"),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
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react"),a=require("lucide-react"),r=require("../../primitives/components/data-summaries.cjs"),p=t=>{const{type:n,label:s}=t;return s||n.replace(/_/g," ").replace(/\b\w/g,i=>i.toUpperCase())},u={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"}),...u},m=o.memo(({summary:t,showConnector:n})=>{const s=o.useMemo(()=>t.details&&Object.keys(t.details).length>0?JSON.stringify(t.details,null,2):null,[t.details]),i=o.useMemo(()=>p(t),[t]),c=o.useMemo(()=>h[t.type]||h.default,[t.type]);return e.jsxs(r.DataSummaryItem,{className:"flex items-start gap-2 text-xs relative",children:[n&&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=o.memo(({summaries:t,isCompleted:n})=>{const s=t.length>1,[i,c]=o.useState(!n||!s);o.useEffect(()=>{let l;return n&&s?l=setTimeout(()=>{c(!1)},1e3):c(!0),()=>{l&&clearTimeout(l)}},[n,s]);const d=o.useCallback(()=>{s&&c(!i)},[s,i]);return s?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:d,"data-expanded":i,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:n?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":i,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((l,x)=>e.jsx(m,{summary:l,showConnector:t.length>1&&x<t.length-1},`op-${l.type}-${x}`))})})]}):e.jsx(r.DataSummaryGroup,{className:"flex flex-col items-start mb-2.5 mt-2.5 first:mt-1 relative",children:e.jsx(r.DataSummaryList,{className:"pb-2 mt-1.5 space-y-3 relative",children:t.map((l,x)=>e.jsx(m,{summary:l,showConnector:!1},`op-${l.type}-${x}`))})})});exports.DataSummaryGroup=g;