@inkeep/agents-ui 0.14.12 → 0.14.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1225,17 +1225,7 @@ export declare const dataAttr: (guard: boolean | undefined) => Booleanish;
1225
1225
 
1226
1226
  declare type DataParts = {
1227
1227
  operation: {
1228
- type:
1229
- | 'error'
1230
- | 'agent_initializing'
1231
- | 'completion'
1232
- | 'agent_generate'
1233
- | 'agent_reasoning'
1234
- | 'tool_execution'
1235
- | 'transfer'
1236
- | 'delegation_sent'
1237
- | 'delegation_returned'
1238
- | 'artifact_saved'
1228
+ type: OperationType
1239
1229
  ctx: Record<string, unknown>
1240
1230
  message?: string
1241
1231
  label?: string
@@ -3851,6 +3841,19 @@ export declare const ModalProvider: React.FC<{
3851
3841
 
3852
3842
  declare type OnLoadingStatusChange = AvatarPrimitive.AvatarImageProps['onLoadingStatusChange'];
3853
3843
 
3844
+ declare type OperationType =
3845
+ | 'error'
3846
+ | 'agent_initializing'
3847
+ | 'completion'
3848
+ | 'agent_generate'
3849
+ | 'agent_reasoning'
3850
+ | 'tool_call'
3851
+ | 'tool_result'
3852
+ | 'transfer'
3853
+ | 'delegation_sent'
3854
+ | 'delegation_returned'
3855
+ | 'artifact_saved'
3856
+
3854
3857
  declare const Overlay: React_2.ForwardRefExoticComponent<DialogOverlayProps & React_2.RefAttributes<HTMLDivElement>>;
3855
3858
 
3856
3859
  export declare interface PolymorphicProps {
package/dist/index.d.ts CHANGED
@@ -1225,17 +1225,7 @@ export declare const dataAttr: (guard: boolean | undefined) => Booleanish;
1225
1225
 
1226
1226
  declare type DataParts = {
1227
1227
  operation: {
1228
- type:
1229
- | 'error'
1230
- | 'agent_initializing'
1231
- | 'completion'
1232
- | 'agent_generate'
1233
- | 'agent_reasoning'
1234
- | 'tool_execution'
1235
- | 'transfer'
1236
- | 'delegation_sent'
1237
- | 'delegation_returned'
1238
- | 'artifact_saved'
1228
+ type: OperationType
1239
1229
  ctx: Record<string, unknown>
1240
1230
  message?: string
1241
1231
  label?: string
@@ -3851,6 +3841,19 @@ export declare const ModalProvider: React.FC<{
3851
3841
 
3852
3842
  declare type OnLoadingStatusChange = AvatarPrimitive.AvatarImageProps['onLoadingStatusChange'];
3853
3843
 
3844
+ declare type OperationType =
3845
+ | 'error'
3846
+ | 'agent_initializing'
3847
+ | 'completion'
3848
+ | 'agent_generate'
3849
+ | 'agent_reasoning'
3850
+ | 'tool_call'
3851
+ | 'tool_result'
3852
+ | 'transfer'
3853
+ | 'delegation_sent'
3854
+ | 'delegation_returned'
3855
+ | 'artifact_saved'
3856
+
3854
3857
  declare const Overlay: React_2.ForwardRefExoticComponent<DialogOverlayProps & React_2.RefAttributes<HTMLDivElement>>;
3855
3858
 
3856
3859
  export declare interface PolymorphicProps {
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),T=require("react"),m=require("@radix-ui/primitive"),P=require("@radix-ui/react-compose-refs"),H=require("@radix-ui/react-context"),R=require("@radix-ui/react-id"),W=require("@radix-ui/react-use-controllable-state"),z=require("@radix-ui/react-dismissable-layer"),B=require("@zag-js/focus-trap"),K=require("@radix-ui/react-portal"),_=require("@radix-ui/react-presence"),f=require("@radix-ui/react-primitive"),U=require("@radix-ui/react-focus-guards"),V=require("react-remove-scroll"),Y=require("aria-hidden"),Z=require("@radix-ui/react-slot");function J(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,s.get?s:{enumerable:!0,get:()=>e[o]})}}return r.default=e,Object.freeze(r)}const c=J(T),x="Dialog",[N,Q]=H.createContextScope(x),[X,l]=N(x),O=e=>{const{__scopeDialog:r,children:o,open:s,defaultOpen:n,onOpenChange:t,modal:a=!0}=e,u=c.useRef(null),p=c.useRef(null),[g=!1,D]=W.useControllableState({prop:s,defaultProp:n??!1,onChange:t});return i.jsx(X,{scope:r,triggerRef:u,contentRef:p,contentId:R.useId(),titleId:R.useId(),descriptionId:R.useId(),open:g,onOpenChange:D,onOpenToggle:c.useCallback(()=>D(G=>!G),[D]),modal:a,children:o})};O.displayName=x;const M="DialogTrigger",S=c.forwardRef((e,r)=>{const{__scopeDialog:o,...s}=e,n=l(M,o),t=P.useComposedRefs(r,n.triggerRef);return i.jsx(f.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":j(n.open),...s,ref:t,onClick:m.composeEventHandlers(e.onClick,n.onOpenToggle)})});S.displayName=M;const v="DialogPortal",[$,q]=N(v,{forceMount:void 0}),y=e=>{const{__scopeDialog:r,forceMount:o,children:s,container:n}=e,t=l(v,r);return i.jsx($,{scope:r,forceMount:o,children:c.Children.map(s,a=>i.jsx(_.Presence,{present:o||t.open,children:i.jsx(K.Portal,{asChild:!0,container:n,children:a})}))})};y.displayName=v;const C="DialogOverlay",E=c.forwardRef((e,r)=>{const o=q(C,e.__scopeDialog),{forceMount:s=o.forceMount,...n}=e,t=l(C,e.__scopeDialog);return t.modal?i.jsx(_.Presence,{present:s||t.open,children:i.jsx(ee,{...n,ref:r})}):null});E.displayName=C;const ee=c.forwardRef((e,r)=>{const{__scopeDialog:o,...s}=e,n=l(C,o);return i.jsx(V.RemoveScroll,{as:Z.Slot,allowPinchZoom:!0,shards:[n.contentRef],gapMode:"padding",removeScrollBar:!0,children:i.jsx(f.Primitive.div,{"data-state":j(n.open),...s,ref:r,style:{pointerEvents:"auto",...s.style}})})}),d="DialogContent",h=c.forwardRef((e,r)=>{const o=q(d,e.__scopeDialog),{forceMount:s=o.forceMount,...n}=e,t=l(d,e.__scopeDialog);return i.jsx(_.Presence,{present:s||t.open,children:t.modal?i.jsx(te,{...n,ref:r}):i.jsx(oe,{...n,ref:r})})});h.displayName=d;const te=c.forwardRef((e,r)=>{const o=l(d,e.__scopeDialog),s=c.useRef(null),n=P.useComposedRefs(r,o.contentRef,s);return c.useEffect(()=>{const t=s.current;if(t){const a=document.querySelectorAll("[data-ikp-component]");return Y.hideOthers([t,...Array.from(a)])}},[]),i.jsx(A,{...e,ref:n,trapFocus:o.open,disableOutsidePointerEvents:!0,onPointerDownOutside:m.composeEventHandlers(e.onPointerDownOutside,t=>{const a=t.detail.originalEvent,u=a.button===0&&a.ctrlKey===!0;(a.button===2||u)&&t.preventDefault(),t.target.closest("[data-ikp-component]")&&t.preventDefault()}),onFocusOutside:m.composeEventHandlers(e.onFocusOutside,t=>t.preventDefault())})}),oe=c.forwardRef((e,r)=>{const o=l(d,e.__scopeDialog),s=c.useRef(!1),n=c.useRef(!1);return i.jsx(A,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(s.current=!0,t.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const a=t.target;o.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type==="focusin"&&n.current&&t.preventDefault()}})}),A=c.forwardRef((e,r)=>{const{__scopeDialog:o,trapFocus:s,onOpenAutoFocus:n,onCloseAutoFocus:t,...a}=e,u=l(d,o),p=c.useRef(null),g=P.useComposedRefs(r,p);return U.useFocusGuards(),T.useEffect(()=>{if(s)return B.trapFocus(p.current,{preventScroll:!0,onActivate:n,onDeactivate:t,initialFocus:!1})},[]),i.jsx(z.DismissableLayer,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":j(u.open),...a,ref:g,onDismiss:()=>u.onOpenChange(!1)})}),w="DialogTitle",I=c.forwardRef((e,r)=>{const{__scopeDialog:o,...s}=e,n=l(w,o);return i.jsx(f.Primitive.h2,{id:n.titleId,...s,ref:r})});I.displayName=w;const k="DialogDescription",F=c.forwardRef((e,r)=>{const{__scopeDialog:o,...s}=e,n=l(k,o);return i.jsx(f.Primitive.p,{id:n.descriptionId,...s,ref:r})});F.displayName=k;const L="DialogClose",b=c.forwardRef((e,r)=>{const{__scopeDialog:o,...s}=e,n=l(L,o);return i.jsx(f.Primitive.button,{type:"button",...s,ref:r,onClick:m.composeEventHandlers(e.onClick,()=>n.onOpenChange(!1))})});b.displayName=L;function j(e){return e?"open":"closed"}const ne=O,re=y,se=E,ce=h,ie=I,ae=b;exports.Close=ae;exports.Content=ce;exports.Dialog=O;exports.DialogClose=b;exports.DialogContent=h;exports.DialogDescription=F;exports.DialogOverlay=E;exports.DialogPortal=y;exports.DialogTitle=I;exports.DialogTrigger=S;exports.Overlay=se;exports.Portal=re;exports.Root=ne;exports.Title=ie;exports.createDialogScope=Q;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),P=require("react"),m=require("@radix-ui/primitive"),O=require("@radix-ui/react-compose-refs"),H=require("@radix-ui/react-context"),R=require("@radix-ui/react-id"),W=require("@radix-ui/react-use-controllable-state"),z=require("@radix-ui/react-dismissable-layer"),B=require("@zag-js/focus-trap"),K=require("@radix-ui/react-portal"),_=require("@radix-ui/react-presence"),g=require("@radix-ui/react-primitive"),U=require("@radix-ui/react-focus-guards"),V=require("aria-hidden"),Y=require("@zag-js/remove-scroll"),$=require("./shadow/context.cjs");function J(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(n,o,s.get?s:{enumerable:!0,get:()=>e[o]})}}return n.default=e,Object.freeze(n)}const c=J(P),x="Dialog",[w,Q]=H.createContextScope(x),[X,l]=w(x),y=e=>{const{__scopeDialog:n,children:o,open:s,defaultOpen:r,onOpenChange:t,modal:a=!0}=e,u=c.useRef(null),f=c.useRef(null),[D=!1,d]=W.useControllableState({prop:s,defaultProp:r??!1,onChange:t});return i.jsx(X,{scope:n,triggerRef:u,contentRef:f,contentId:R.useId(),titleId:R.useId(),descriptionId:R.useId(),open:D,onOpenChange:d,onOpenToggle:c.useCallback(()=>d(N=>!N),[d]),modal:a,children:o})};y.displayName=x;const M="DialogTrigger",q=c.forwardRef((e,n)=>{const{__scopeDialog:o,...s}=e,r=l(M,o),t=O.useComposedRefs(n,r.triggerRef);return i.jsx(g.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":T(r.open),...s,ref:t,onClick:m.composeEventHandlers(e.onClick,r.onOpenToggle)})});q.displayName=M;const v="DialogPortal",[Z,S]=w(v,{forceMount:void 0}),E=e=>{const{__scopeDialog:n,forceMount:o,children:s,container:r}=e,t=l(v,n);return i.jsx(Z,{scope:n,forceMount:o,children:c.Children.map(s,a=>i.jsx(_.Presence,{present:o||t.open,children:i.jsx(K.Portal,{asChild:!0,container:r,children:a})}))})};E.displayName=v;const C="DialogOverlay",I=c.forwardRef((e,n)=>{const o=S(C,e.__scopeDialog),{forceMount:s=o.forceMount,...r}=e,t=l(C,e.__scopeDialog);return t.modal?i.jsx(_.Presence,{present:s||t.open,children:i.jsx(ee,{...r,ref:n})}):null});I.displayName=C;const ee=c.forwardRef((e,n)=>{const{__scopeDialog:o,...s}=e,r=l(C,o),t=$.useShadow();return P.useEffect(()=>{t&&Y.preventBodyScroll(t?.rootElement?.ownerDocument)},[t]),i.jsx(g.Primitive.div,{"data-state":T(r.open),...s,ref:n,style:{pointerEvents:"auto",...s.style}})}),p="DialogContent",h=c.forwardRef((e,n)=>{const o=S(p,e.__scopeDialog),{forceMount:s=o.forceMount,...r}=e,t=l(p,e.__scopeDialog);return i.jsx(_.Presence,{present:s||t.open,children:t.modal?i.jsx(te,{...r,ref:n}):i.jsx(oe,{...r,ref:n})})});h.displayName=p;const te=c.forwardRef((e,n)=>{const o=l(p,e.__scopeDialog),s=c.useRef(null),r=O.useComposedRefs(n,o.contentRef,s);return c.useEffect(()=>{const t=s.current;if(t){const a=document.querySelectorAll("[data-ikp-component]");return V.hideOthers([t,...Array.from(a)])}},[]),i.jsx(k,{...e,ref:r,trapFocus:o.open,disableOutsidePointerEvents:!0,onPointerDownOutside:m.composeEventHandlers(e.onPointerDownOutside,t=>{const a=t.detail.originalEvent,u=a.button===0&&a.ctrlKey===!0;(a.button===2||u)&&t.preventDefault(),t.target.closest("[data-ikp-component]")&&t.preventDefault()}),onFocusOutside:m.composeEventHandlers(e.onFocusOutside,t=>t.preventDefault())})}),oe=c.forwardRef((e,n)=>{const o=l(p,e.__scopeDialog),s=c.useRef(!1),r=c.useRef(!1);return i.jsx(k,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(s.current=!0,t.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=t.target;o.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type==="focusin"&&r.current&&t.preventDefault()}})}),k=c.forwardRef((e,n)=>{const{__scopeDialog:o,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:t,...a}=e,u=l(p,o),f=c.useRef(null),D=O.useComposedRefs(n,f);return U.useFocusGuards(),P.useEffect(()=>{if(s)return B.trapFocus(f.current,{preventScroll:!0,onActivate:r,onDeactivate:t,initialFocus:!1,allowOutsideClick:d=>!!d.target.closest("[data-ikp-component]")})},[]),i.jsx(z.DismissableLayer,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":T(u.open),...a,ref:D,onDismiss:()=>u.onOpenChange(!1)})}),A="DialogTitle",b=c.forwardRef((e,n)=>{const{__scopeDialog:o,...s}=e,r=l(A,o);return i.jsx(g.Primitive.h2,{id:r.titleId,...s,ref:n})});b.displayName=A;const F="DialogDescription",L=c.forwardRef((e,n)=>{const{__scopeDialog:o,...s}=e,r=l(F,o);return i.jsx(g.Primitive.p,{id:r.descriptionId,...s,ref:n})});L.displayName=F;const G="DialogClose",j=c.forwardRef((e,n)=>{const{__scopeDialog:o,...s}=e,r=l(G,o);return i.jsx(g.Primitive.button,{type:"button",...s,ref:n,onClick:m.composeEventHandlers(e.onClick,()=>r.onOpenChange(!1))})});j.displayName=G;function T(e){return e?"open":"closed"}const ne=y,re=E,se=I,ce=h,ie=b,ae=j;exports.Close=ae;exports.Content=ce;exports.Dialog=y;exports.DialogClose=j;exports.DialogContent=h;exports.DialogDescription=L;exports.DialogOverlay=I;exports.DialogPortal=E;exports.DialogTitle=b;exports.DialogTrigger=q;exports.Overlay=se;exports.Portal=re;exports.Root=ne;exports.Title=ie;exports.createDialogScope=Q;
@@ -1,167 +1,165 @@
1
1
  "use client";
2
2
  import { jsx as c } from "react/jsx-runtime";
3
3
  import * as i from "react";
4
- import { useEffect as G } from "react";
4
+ import { useEffect as I } from "react";
5
5
  import { composeEventHandlers as D } from "@radix-ui/primitive";
6
6
  import { useComposedRefs as _ } from "@radix-ui/react-compose-refs";
7
7
  import { createContextScope as W } from "@radix-ui/react-context";
8
- import { useId as C } from "@radix-ui/react-id";
8
+ import { useId as R } from "@radix-ui/react-id";
9
9
  import { useControllableState as $ } from "@radix-ui/react-use-controllable-state";
10
10
  import { DismissableLayer as j } from "@radix-ui/react-dismissable-layer";
11
11
  import { trapFocus as q } from "@zag-js/focus-trap";
12
12
  import { Portal as B } from "@radix-ui/react-portal";
13
13
  import { Presence as O } from "@radix-ui/react-presence";
14
- import { Primitive as d } from "@radix-ui/react-primitive";
14
+ import { Primitive as g } from "@radix-ui/react-primitive";
15
15
  import { useFocusGuards as H } from "@radix-ui/react-focus-guards";
16
- import { RemoveScroll as K } from "react-remove-scroll";
17
- import { hideOthers as V } from "aria-hidden";
18
- import { Slot as Y } from "@radix-ui/react-slot";
19
- const P = "Dialog", [E, Co] = W(P), [Z, l] = E(P), I = (o) => {
20
- const { __scopeDialog: n, children: r, open: s, defaultOpen: e, onOpenChange: t, modal: a = !0 } = o, p = i.useRef(null), u = i.useRef(null), [g = !1, m] = $({
16
+ import { hideOthers as K } from "aria-hidden";
17
+ import { preventBodyScroll as V } from "@zag-js/remove-scroll";
18
+ import { useShadow as Y } from "./shadow/context.js";
19
+ const P = "Dialog", [v, Ct] = W(P), [z, l] = v(P), x = (t) => {
20
+ const { __scopeDialog: n, children: r, open: s, defaultOpen: e, onOpenChange: o, modal: a = !0 } = t, p = i.useRef(null), d = i.useRef(null), [m = !1, f] = $({
21
21
  prop: s,
22
22
  defaultProp: e ?? !1,
23
- onChange: t
23
+ onChange: o
24
24
  });
25
25
  return /* @__PURE__ */ c(
26
- Z,
26
+ z,
27
27
  {
28
28
  scope: n,
29
29
  triggerRef: p,
30
- contentRef: u,
31
- contentId: C(),
32
- titleId: C(),
33
- descriptionId: C(),
34
- open: g,
35
- onOpenChange: m,
36
- onOpenToggle: i.useCallback(() => m((L) => !L), [m]),
30
+ contentRef: d,
31
+ contentId: R(),
32
+ titleId: R(),
33
+ descriptionId: R(),
34
+ open: m,
35
+ onOpenChange: f,
36
+ onOpenToggle: i.useCallback(() => f((E) => !E), [f]),
37
37
  modal: a,
38
38
  children: r
39
39
  }
40
40
  );
41
41
  };
42
- I.displayName = P;
43
- const v = "DialogTrigger", z = i.forwardRef(
44
- (o, n) => {
45
- const { __scopeDialog: r, ...s } = o, e = l(v, r), t = _(n, e.triggerRef);
42
+ x.displayName = P;
43
+ const N = "DialogTrigger", J = i.forwardRef(
44
+ (t, n) => {
45
+ const { __scopeDialog: r, ...s } = t, e = l(N, r), o = _(n, e.triggerRef);
46
46
  return /* @__PURE__ */ c(
47
- d.button,
47
+ g.button,
48
48
  {
49
49
  type: "button",
50
50
  "aria-haspopup": "dialog",
51
51
  "aria-expanded": e.open,
52
52
  "aria-controls": e.contentId,
53
- "data-state": y(e.open),
53
+ "data-state": h(e.open),
54
54
  ...s,
55
- ref: t,
56
- onClick: D(o.onClick, e.onOpenToggle)
55
+ ref: o,
56
+ onClick: D(t.onClick, e.onOpenToggle)
57
57
  }
58
58
  );
59
59
  }
60
60
  );
61
- z.displayName = v;
62
- const h = "DialogPortal", [J, x] = E(h, {
61
+ J.displayName = N;
62
+ const y = "DialogPortal", [Q, w] = v(y, {
63
63
  forceMount: void 0
64
- }), N = (o) => {
65
- const { __scopeDialog: n, forceMount: r, children: s, container: e } = o, t = l(h, n);
66
- return /* @__PURE__ */ c(J, { scope: n, forceMount: r, children: i.Children.map(s, (a) => /* @__PURE__ */ c(O, { present: r || t.open, children: /* @__PURE__ */ c(B, { asChild: !0, container: e, children: a }) })) });
64
+ }), T = (t) => {
65
+ const { __scopeDialog: n, forceMount: r, children: s, container: e } = t, o = l(y, n);
66
+ return /* @__PURE__ */ c(Q, { scope: n, forceMount: r, children: i.Children.map(s, (a) => /* @__PURE__ */ c(O, { present: r || o.open, children: /* @__PURE__ */ c(B, { asChild: !0, container: e, children: a }) })) });
67
67
  };
68
- N.displayName = h;
69
- const R = "DialogOverlay", M = i.forwardRef(
70
- (o, n) => {
71
- const r = x(R, o.__scopeDialog), { forceMount: s = r.forceMount, ...e } = o, t = l(R, o.__scopeDialog);
72
- return t.modal ? /* @__PURE__ */ c(O, { present: s || t.open, children: /* @__PURE__ */ c(Q, { ...e, ref: n }) }) : null;
68
+ T.displayName = y;
69
+ const C = "DialogOverlay", A = i.forwardRef(
70
+ (t, n) => {
71
+ const r = w(C, t.__scopeDialog), { forceMount: s = r.forceMount, ...e } = t, o = l(C, t.__scopeDialog);
72
+ return o.modal ? /* @__PURE__ */ c(O, { present: s || o.open, children: /* @__PURE__ */ c(U, { ...e, ref: n }) }) : null;
73
73
  }
74
74
  );
75
- M.displayName = R;
76
- const Q = i.forwardRef(
77
- (o, n) => {
78
- const { __scopeDialog: r, ...s } = o, e = l(R, r);
79
- return (
80
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
81
- // ie. when `Overlay` and `Content` are siblings
82
- /* @__PURE__ */ c(
83
- K,
84
- {
85
- as: Y,
86
- allowPinchZoom: !0,
87
- shards: [e.contentRef],
88
- gapMode: "padding",
89
- removeScrollBar: !0,
90
- children: /* @__PURE__ */ c(
91
- d.div,
92
- {
93
- "data-state": y(e.open),
94
- ...s,
95
- ref: n,
96
- style: { pointerEvents: "auto", ...s.style }
97
- }
98
- )
99
- }
100
- )
75
+ A.displayName = C;
76
+ const U = i.forwardRef(
77
+ (t, n) => {
78
+ const { __scopeDialog: r, ...s } = t, e = l(C, r), o = Y();
79
+ return I(() => {
80
+ o && V(o?.rootElement?.ownerDocument);
81
+ }, [o]), // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
82
+ // ie. when `Overlay` and `Content` are siblings
83
+ // <RemoveScroll
84
+ // as={Slot}
85
+ // allowPinchZoom
86
+ // shards={[context.contentRef]}
87
+ // gapMode="padding"
88
+ // removeScrollBar={true}
89
+ // >
90
+ /* @__PURE__ */ c(
91
+ g.div,
92
+ {
93
+ "data-state": h(e.open),
94
+ ...s,
95
+ ref: n,
96
+ style: { pointerEvents: "auto", ...s.style }
97
+ }
101
98
  );
102
99
  }
103
- ), f = "DialogContent", T = i.forwardRef(
104
- (o, n) => {
105
- const r = x(f, o.__scopeDialog), { forceMount: s = r.forceMount, ...e } = o, t = l(f, o.__scopeDialog);
106
- return /* @__PURE__ */ c(O, { present: s || t.open, children: t.modal ? /* @__PURE__ */ c(U, { ...e, ref: n }) : /* @__PURE__ */ c(X, { ...e, ref: n }) });
100
+ ), u = "DialogContent", M = i.forwardRef(
101
+ (t, n) => {
102
+ const r = w(u, t.__scopeDialog), { forceMount: s = r.forceMount, ...e } = t, o = l(u, t.__scopeDialog);
103
+ return /* @__PURE__ */ c(O, { present: s || o.open, children: o.modal ? /* @__PURE__ */ c(X, { ...e, ref: n }) : /* @__PURE__ */ c(Z, { ...e, ref: n }) });
107
104
  }
108
105
  );
109
- T.displayName = f;
110
- const U = i.forwardRef(
111
- (o, n) => {
112
- const r = l(f, o.__scopeDialog), s = i.useRef(null), e = _(n, r.contentRef, s);
106
+ M.displayName = u;
107
+ const X = i.forwardRef(
108
+ (t, n) => {
109
+ const r = l(u, t.__scopeDialog), s = i.useRef(null), e = _(n, r.contentRef, s);
113
110
  return i.useEffect(() => {
114
- const t = s.current;
115
- if (t) {
111
+ const o = s.current;
112
+ if (o) {
116
113
  const a = document.querySelectorAll("[data-ikp-component]");
117
- return V([t, ...Array.from(a)]);
114
+ return K([o, ...Array.from(a)]);
118
115
  }
119
116
  }, []), /* @__PURE__ */ c(
120
- A,
117
+ b,
121
118
  {
122
- ...o,
119
+ ...t,
123
120
  ref: e,
124
121
  trapFocus: r.open,
125
122
  disableOutsidePointerEvents: !0,
126
- onPointerDownOutside: D(o.onPointerDownOutside, (t) => {
127
- const a = t.detail.originalEvent, p = a.button === 0 && a.ctrlKey === !0;
128
- (a.button === 2 || p) && t.preventDefault(), t.target.closest("[data-ikp-component]") && t.preventDefault();
123
+ onPointerDownOutside: D(t.onPointerDownOutside, (o) => {
124
+ const a = o.detail.originalEvent, p = a.button === 0 && a.ctrlKey === !0;
125
+ (a.button === 2 || p) && o.preventDefault(), o.target.closest("[data-ikp-component]") && o.preventDefault();
129
126
  }),
130
127
  onFocusOutside: D(
131
- o.onFocusOutside,
132
- (t) => t.preventDefault()
128
+ t.onFocusOutside,
129
+ (o) => o.preventDefault()
133
130
  )
134
131
  }
135
132
  );
136
133
  }
137
- ), X = i.forwardRef(
138
- (o, n) => {
139
- const r = l(f, o.__scopeDialog), s = i.useRef(!1), e = i.useRef(!1);
134
+ ), Z = i.forwardRef(
135
+ (t, n) => {
136
+ const r = l(u, t.__scopeDialog), s = i.useRef(!1), e = i.useRef(!1);
140
137
  return /* @__PURE__ */ c(
141
- A,
138
+ b,
142
139
  {
143
- ...o,
140
+ ...t,
144
141
  ref: n,
145
142
  trapFocus: !1,
146
143
  disableOutsidePointerEvents: !1,
147
- onInteractOutside: (t) => {
148
- o.onInteractOutside?.(t), t.defaultPrevented || (s.current = !0, t.detail.originalEvent.type === "pointerdown" && (e.current = !0));
149
- const a = t.target;
150
- r.triggerRef.current?.contains(a) && t.preventDefault(), t.detail.originalEvent.type === "focusin" && e.current && t.preventDefault();
144
+ onInteractOutside: (o) => {
145
+ t.onInteractOutside?.(o), o.defaultPrevented || (s.current = !0, o.detail.originalEvent.type === "pointerdown" && (e.current = !0));
146
+ const a = o.target;
147
+ r.triggerRef.current?.contains(a) && o.preventDefault(), o.detail.originalEvent.type === "focusin" && e.current && o.preventDefault();
151
148
  }
152
149
  }
153
150
  );
154
151
  }
155
- ), A = i.forwardRef(
156
- (o, n) => {
157
- const { __scopeDialog: r, trapFocus: s, onOpenAutoFocus: e, onCloseAutoFocus: t, ...a } = o, p = l(f, r), u = i.useRef(null), g = _(n, u);
158
- return H(), G(() => {
152
+ ), b = i.forwardRef(
153
+ (t, n) => {
154
+ const { __scopeDialog: r, trapFocus: s, onOpenAutoFocus: e, onCloseAutoFocus: o, ...a } = t, p = l(u, r), d = i.useRef(null), m = _(n, d);
155
+ return H(), I(() => {
159
156
  if (s)
160
- return q(u.current, {
157
+ return q(d.current, {
161
158
  preventScroll: !0,
162
159
  onActivate: e,
163
- onDeactivate: t,
164
- initialFocus: !1
160
+ onDeactivate: o,
161
+ initialFocus: !1,
162
+ allowOutsideClick: (f) => !!f.target.closest("[data-ikp-component]")
165
163
  });
166
164
  }, []), /* @__PURE__ */ c(
167
165
  j,
@@ -170,60 +168,60 @@ const U = i.forwardRef(
170
168
  id: p.contentId,
171
169
  "aria-describedby": p.descriptionId,
172
170
  "aria-labelledby": p.titleId,
173
- "data-state": y(p.open),
171
+ "data-state": h(p.open),
174
172
  ...a,
175
- ref: g,
173
+ ref: m,
176
174
  onDismiss: () => p.onOpenChange(!1)
177
175
  }
178
176
  );
179
177
  }
180
- ), b = "DialogTitle", w = i.forwardRef(
181
- (o, n) => {
182
- const { __scopeDialog: r, ...s } = o, e = l(b, r);
183
- return /* @__PURE__ */ c(d.h2, { id: e.titleId, ...s, ref: n });
178
+ ), k = "DialogTitle", F = i.forwardRef(
179
+ (t, n) => {
180
+ const { __scopeDialog: r, ...s } = t, e = l(k, r);
181
+ return /* @__PURE__ */ c(g.h2, { id: e.titleId, ...s, ref: n });
184
182
  }
185
183
  );
186
- w.displayName = b;
187
- const k = "DialogDescription", oo = i.forwardRef(
188
- (o, n) => {
189
- const { __scopeDialog: r, ...s } = o, e = l(k, r);
190
- return /* @__PURE__ */ c(d.p, { id: e.descriptionId, ...s, ref: n });
184
+ F.displayName = k;
185
+ const S = "DialogDescription", tt = i.forwardRef(
186
+ (t, n) => {
187
+ const { __scopeDialog: r, ...s } = t, e = l(S, r);
188
+ return /* @__PURE__ */ c(g.p, { id: e.descriptionId, ...s, ref: n });
191
189
  }
192
190
  );
193
- oo.displayName = k;
194
- const F = "DialogClose", S = i.forwardRef(
195
- (o, n) => {
196
- const { __scopeDialog: r, ...s } = o, e = l(F, r);
191
+ tt.displayName = S;
192
+ const L = "DialogClose", G = i.forwardRef(
193
+ (t, n) => {
194
+ const { __scopeDialog: r, ...s } = t, e = l(L, r);
197
195
  return /* @__PURE__ */ c(
198
- d.button,
196
+ g.button,
199
197
  {
200
198
  type: "button",
201
199
  ...s,
202
200
  ref: n,
203
- onClick: D(o.onClick, () => e.onOpenChange(!1))
201
+ onClick: D(t.onClick, () => e.onOpenChange(!1))
204
202
  }
205
203
  );
206
204
  }
207
205
  );
208
- S.displayName = F;
209
- function y(o) {
210
- return o ? "open" : "closed";
206
+ G.displayName = L;
207
+ function h(t) {
208
+ return t ? "open" : "closed";
211
209
  }
212
- const _o = I, Oo = N, Po = M, ho = T, yo = w, Eo = S;
210
+ const Rt = x, _t = T, Ot = A, Pt = M, yt = F, ht = G;
213
211
  export {
214
- Eo as Close,
215
- ho as Content,
216
- I as Dialog,
217
- S as DialogClose,
218
- T as DialogContent,
219
- oo as DialogDescription,
220
- M as DialogOverlay,
221
- N as DialogPortal,
222
- w as DialogTitle,
223
- z as DialogTrigger,
224
- Po as Overlay,
225
- Oo as Portal,
226
- _o as Root,
227
- yo as Title,
228
- Co as createDialogScope
212
+ ht as Close,
213
+ Pt as Content,
214
+ x as Dialog,
215
+ G as DialogClose,
216
+ M as DialogContent,
217
+ tt as DialogDescription,
218
+ A as DialogOverlay,
219
+ T as DialogPortal,
220
+ F as DialogTitle,
221
+ J as DialogTrigger,
222
+ Ot as Overlay,
223
+ _t as Portal,
224
+ Rt as Root,
225
+ yt as Title,
226
+ Ct as createDialogScope
229
227
  };
@@ -1,3 +1,3 @@
1
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"),q=`Hmm..
2
2
 
3
- It seems I might be having some issues right now. Please clear the chat and try again.`,ie=()=>{const{baseSettings:f,aiChatSettings:o}=Z.useInkeepConfig(),[n="",v]=ae.useControllableState({prop:o.conversationId,defaultProp:o.conversationId??""}),{logEvent:i}=se.useBaseEvents(),{setConversationId:F,emitStreamError:R}=oe.useStreamingEvents(),[a,u]=t.useState(""),k=e=>u(e.target.value),{filters:S}=f,{onInputMessageChange:A,filters:E,agentUrl:P,context:x,headers:D,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 ${f.organizationDisplayName??"Administrator"}`;default:return q}},[U,T]=t.useState({}),[B,l]=t.useState([]),[O,I]=t.useState(null),{messages:g,sendMessage:K,status:b,setMessages:y,stop:L,error:d}=X.useChat({transport:new Y.DefaultChatTransport({api:P,headers:{...C?{Authorization:`Bearer ${C}`}:{},...D},body:{requestContext:x}}),async onFinish(){await i({eventName:"assistant_message_received",properties:{conversationId:n}}),i({eventName:"assistant_answer_displayed",properties:{conversationId:n}})},onError(e){console.log("onError",e.message),R(e.message,void 0,e.code?.toString()),y(c=>{const r=[...c],s=r[r.length-1];return s&&(s.parts=[{type:"text",text:N(e)}]),r})}}),w=b==="submitted",W=b==="streaming",$=g.length===0,m=!a.trim()||w,z=ee.useMediaQuery("(max-width: 768px)"),[G,p]=t.useState(null);t.useEffect(()=>{d&&p(d)},[d]);const H=()=>p(null),M=t.useRef(null);t.useEffect(()=>{A?.(a)},[a]);const Q=e=>{e.key==="Enter"&&!e.shiftKey&&!m&&!e.nativeEvent.isComposing&&(e.preventDefault(),h())},h=async(e=a)=>{if(m&&(!e||e.trim().length===0))return;l([]),u(""),await i({eventName:"user_message_submitted",properties:{conversationId:n}});const c=S||E?JSON.stringify({...S,...E}):void 0,r={};c&&(r["inkeep-filters"]=c);let s=n;s||(s=`conv_${te.generateUid(16)}`,v(s)),F(s),K({text:e},{headers:r,body:{conversationId:s}})},j=()=>{L()},_=()=>{H(),y([]),v(""),T({}),l([]),I(null),i({eventName:"chat_clear_button_clicked",properties:{conversationId:n}})},{openForm:J}=ne.useChatForm(),V=re.useWidget();return t.useImperativeHandle(o.chatFunctionsRef,()=>({submitMessage:h,updateInputMessage(e){u(e)},clearChat:_,openForm:e=>{V?.setView("chat"),J(e,void 0)},focusInput:()=>{M.current?.focus()}})),{messages:g,isLoading:w,isStreaming:W,error:G,setError:p,isSubmitDisabled:m,input:a,handleInputChange:k,handleInputKeyDown:Q,handleSubmit:h,stop:j,clear:_,messageButtons:U,isEmpty:g.length===0,inputRef:M,isMobile:z,messageAttachments:B,setMessageAttachments:l,selectedWorkflow:O,setSelectedWorkflow:I,isNewChat:$,conversationId:n}};exports.DEFAULT_ERROR_MESSAGE=q;exports.useInkeepChat=ie;
3
+ It seems I might be having some issues right now. Please clear the chat and try again.`,ie=()=>{const{baseSettings:f,aiChatSettings:o}=Z.useInkeepConfig(),[n="",v]=ae.useControllableState({prop:o.conversationId,defaultProp:o.conversationId??""}),{logEvent:i}=se.useBaseEvents(),{setConversationId:F,emitToParent:R}=oe.useStreamingEvents(),[a,u]=t.useState(""),P=e=>u(e.target.value),{filters:E}=f,{onInputMessageChange:k,filters:S,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 ${f.organizationDisplayName??"Administrator"}`;default:return q}},[T,U]=t.useState({}),[B,l]=t.useState([]),[O,I]=t.useState(null),{messages:g,sendMessage:K,status:b,setMessages:y,stop:L,error:d}=X.useChat({transport:new Y.DefaultChatTransport({api:A,headers:{...C?{Authorization:`Bearer ${C}`}:{},...x},body:{requestContext:D}}),onData(e){R(e.type,e.data)},async onFinish(){await i({eventName:"assistant_message_received",properties:{conversationId:n}}),i({eventName:"assistant_answer_displayed",properties:{conversationId:n}})},onError(e){console.log("onError",e.message),y(c=>{const r=[...c],s=r[r.length-1];return s&&(s.parts=[{type:"text",text:N(e)}]),r})}}),w=b==="submitted",W=b==="streaming",$=g.length===0,m=!a.trim()||w,z=ee.useMediaQuery("(max-width: 768px)"),[G,p]=t.useState(null);t.useEffect(()=>{d&&p(d)},[d]);const H=()=>p(null),M=t.useRef(null);t.useEffect(()=>{k?.(a)},[a]);const Q=e=>{e.key==="Enter"&&!e.shiftKey&&!m&&!e.nativeEvent.isComposing&&(e.preventDefault(),h())},h=async(e=a)=>{if(m&&(!e||e.trim().length===0))return;l([]),u(""),await i({eventName:"user_message_submitted",properties:{conversationId:n}});const c=E||S?JSON.stringify({...E,...S}):void 0,r={};c&&(r["inkeep-filters"]=c);let s=n;s||(s=`conv_${te.generateUid(16)}`,v(s)),F(s),K({text:e},{headers:r,body:{conversationId:s}})},j=()=>{L()},_=()=>{H(),y([]),v(""),U({}),l([]),I(null),i({eventName:"chat_clear_button_clicked",properties:{conversationId:n}})},{openForm:J}=ne.useChatForm(),V=re.useWidget();return t.useImperativeHandle(o.chatFunctionsRef,()=>({submitMessage:h,updateInputMessage(e){u(e)},clearChat:_,openForm:e=>{V?.setView("chat"),J(e,void 0)},focusInput:()=>{M.current?.focus()}})),{messages:g,isLoading:w,isStreaming:W,error:G,setError:p,isSubmitDisabled:m,input:a,handleInputChange:P,handleInputKeyDown:Q,handleSubmit:h,stop:j,clear:_,messageButtons:T,isEmpty:g.length===0,inputRef:M,isMobile:z,messageAttachments:B,setMessageAttachments:l,selectedWorkflow:O,setSelectedWorkflow:I,isNewChat:$,conversationId:n}};exports.DEFAULT_ERROR_MESSAGE=q;exports.useInkeepChat=ie;
@@ -12,21 +12,21 @@ import { useControllableState as ie } from "@radix-ui/react-use-controllable-sta
12
12
  import { useStreamingEvents as ce } from "../../hooks/use-streaming-events.js";
13
13
  const me = `Hmm..
14
14
 
15
- It seems I might be having some issues right now. Please clear the chat and try again.`, Se = () => {
15
+ It seems I might be having some issues right now. Please clear the chat and try again.`, ye = () => {
16
16
  const { baseSettings: f, aiChatSettings: a } = te(), [s = "", v] = ie({
17
17
  prop: a.conversationId,
18
18
  defaultProp: a.conversationId ?? ""
19
- }), { logEvent: i } = oe(), { setConversationId: F, emitStreamError: k } = ce(), [o, m] = r(""), N = (e) => m(e.target.value), {
19
+ }), { logEvent: i } = oe(), { setConversationId: F, emitToParent: k } = ce(), [o, m] = r(""), D = (e) => m(e.target.value), {
20
20
  /* shouldBypassCaptcha, */
21
21
  filters: I
22
22
  } = f, {
23
- onInputMessageChange: A,
23
+ onInputMessageChange: N,
24
24
  filters: C,
25
- agentUrl: D,
25
+ agentUrl: A,
26
26
  context: R,
27
27
  headers: B,
28
28
  apiKey: E
29
- } = a, K = (e) => {
29
+ } = a, P = (e) => {
30
30
  switch (e.code) {
31
31
  case 400:
32
32
  return e.message;
@@ -35,16 +35,16 @@ It seems I might be having some issues right now. Please clear the chat and try
35
35
  default:
36
36
  return me;
37
37
  }
38
- }, [P, T] = r({}), [U, u] = r([]), [W, S] = r(null), {
38
+ }, [T, K] = r({}), [U, u] = r([]), [W, y] = r(null), {
39
39
  messages: l,
40
40
  sendMessage: $,
41
41
  status: b,
42
- setMessages: y,
42
+ setMessages: w,
43
43
  stop: z,
44
44
  error: p
45
45
  } = X({
46
46
  transport: new Y({
47
- api: D,
47
+ api: A,
48
48
  headers: {
49
49
  ...E ? { Authorization: `Bearer ${E}` } : {},
50
50
  ...B
@@ -53,6 +53,9 @@ It seems I might be having some issues right now. Please clear the chat and try
53
53
  requestContext: R
54
54
  }
55
55
  }),
56
+ onData(e) {
57
+ k(e.type, e.data);
58
+ },
56
59
  async onFinish() {
57
60
  await i({
58
61
  eventName: "assistant_message_received",
@@ -67,18 +70,18 @@ It seems I might be having some issues right now. Please clear the chat and try
67
70
  });
68
71
  },
69
72
  onError(e) {
70
- console.log("onError", e.message), k(e.message, void 0, e.code?.toString()), y((c) => {
73
+ console.log("onError", e.message), w((c) => {
71
74
  const n = [...c], t = n[n.length - 1];
72
- return t && (t.parts = [{ type: "text", text: K(e) }]), n;
75
+ return t && (t.parts = [{ type: "text", text: P(e) }]), n;
73
76
  });
74
77
  }
75
- }), w = b === "submitted", H = b === "streaming", L = l.length === 0, g = !o.trim() || w, O = se("(max-width: 768px)"), [q, d] = r(null);
78
+ }), S = b === "submitted", H = b === "streaming", L = l.length === 0, g = !o.trim() || S, O = se("(max-width: 768px)"), [q, d] = r(null);
76
79
  x(() => {
77
80
  p && d(p);
78
81
  }, [p]);
79
82
  const G = () => d(null), M = Z(null);
80
83
  x(() => {
81
- A?.(o);
84
+ N?.(o);
82
85
  }, [o]);
83
86
  const J = (e) => {
84
87
  e.key === "Enter" && !e.shiftKey && !g && !e.nativeEvent.isComposing && (e.preventDefault(), h());
@@ -112,7 +115,7 @@ It seems I might be having some issues right now. Please clear the chat and try
112
115
  }, Q = () => {
113
116
  z();
114
117
  }, _ = () => {
115
- G(), y([]), v(""), T({}), u([]), S(null), i({
118
+ G(), w([]), v(""), K({}), u([]), y(null), i({
116
119
  eventName: "chat_clear_button_clicked",
117
120
  properties: {
118
121
  conversationId: s
@@ -133,18 +136,18 @@ It seems I might be having some issues right now. Please clear the chat and try
133
136
  }
134
137
  })), {
135
138
  messages: l,
136
- isLoading: w,
139
+ isLoading: S,
137
140
  isStreaming: H,
138
141
  error: q,
139
142
  setError: d,
140
143
  isSubmitDisabled: g,
141
144
  input: o,
142
- handleInputChange: N,
145
+ handleInputChange: D,
143
146
  handleInputKeyDown: J,
144
147
  handleSubmit: h,
145
148
  stop: Q,
146
149
  clear: _,
147
- messageButtons: P,
150
+ messageButtons: T,
148
151
  isEmpty: l.length === 0,
149
152
  inputRef: M,
150
153
  isMobile: O,
@@ -152,12 +155,12 @@ It seems I might be having some issues right now. Please clear the chat and try
152
155
  messageAttachments: U,
153
156
  setMessageAttachments: u,
154
157
  selectedWorkflow: W,
155
- setSelectedWorkflow: S,
158
+ setSelectedWorkflow: y,
156
159
  isNewChat: L,
157
160
  conversationId: s
158
161
  };
159
162
  };
160
163
  export {
161
164
  me as DEFAULT_ERROR_MESSAGE,
162
- Se as useInkeepChat
165
+ ye as useInkeepChat
163
166
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),M=require("./use-inkeep-chat.cjs"),_=require("../../hooks/use-streaming-events.cjs"),q=require("../../../types/message.cjs");function z(u,l,g){const[m,D]=r.useState([]),[d,E]=r.useState(new Map),[y,I]=r.useState(Date.now()),[P,h]=r.useState(!1),w=r.useRef(0),S=r.useRef(0),x=r.useRef([]),f=r.useRef(d);f.current=d;const{emitArtifactSaved:k,emitCompletion:C,emitAgentInitializing:T,emitTextDelta:A}=_.useStreamingEvents(),R=r.useCallback(()=>{const n=[];let e="",o=[],c=!1;u.length>w.current&&(I(Date.now()),w.current=u.length),S.current=0;const p=new Map,i=(t=!1)=>{if(o.length>0){const s=`group-${S.current++}`,a=f.current.get(s);a?p.set(s,{...a,isCompleted:t}):p.set(s,{isCompleted:t}),n.push({type:"summary-group",summaries:[...o],groupKey:s}),o=[]}};for(const t of u)if(t.type==="text")i(!0),t.text&&l&&A(t.text),e+=t.text||"";else if(t.type==="data-summary")e.trim()&&(n.push({type:"text",text:e}),e=""),o.push(t.data);else if(t.type==="data-operation"){e.trim()&&(n.push({type:"text",text:e}),e="");const s=t.data;if(s?.type)switch(s.type){case"completion":C("unknown",1),i(!0);break;case"agent_initializing":T("unknown","unknown");break;case"error":{i(!0);const a=s.message||"Unknown error";console.warn("Data operation error:",a),g(new Error(a)),c||(n.push({type:"text",text:M.DEFAULT_ERROR_MESSAGE}),c=!0);break}default:{const{type:a,label:L}=s;o.push({type:a,label:L});break}}}else if(t.type==="data-artifact")if(t.data?.type?.toLowerCase()===q.CITATION_ARTIFACT_TYPE){const s=t.data,a=s.artifactSummary||{title:s.name};e+=` ^${a?.title||s.name}^`}else e.trim()&&(n.push({type:"text",text:e}),e=""),n.push(t),t.data&&k(t.data.artifactId||"unknown",t.data.taskId||"unknown","unknown",t.data.artifactType||"unknown",t.data.artifactSummary||{},{},{name:t.data.name,description:t.data.description});else t.type==="data-component"&&(e.trim()&&(n.push({type:"text",text:e}),e=""),i(!0),n.push(t));return i(!l),e.trim()&&n.push({type:"text",text:e}),{processed:n,newTimings:p}},[u,l,k,C,T,A,g]);r.useEffect(()=>{if(x.current===u)return;x.current=u;const{processed:n,newTimings:e}=R();D(n),(e.size!==f.current.size||Array.from(e.entries()).some(([c,p])=>{const i=f.current.get(c);return!i||i.isCompleted!==p.isCompleted}))&&E(e)},[R,u]);const v=r.useCallback(()=>{const n=Date.now()-y,e=Array.from(f.current.values()).some(c=>!c.isCompleted),o=n>1e3&&!e;h(o)},[y]);r.useEffect(()=>{if(!l){h(!1);return}if(!(m.length>0)){h(!1);return}const e=setInterval(v,200);return()=>clearInterval(e)},[l,v,m.length]);const b=r.useMemo(()=>!(m.length>0),[m.length]);return{processedParts:m,summaryTimings:d,shouldShowInitialLoading:b,shouldShowStreamDelayLoading:P}}exports.useStreamProcessor=z;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),v=require("./use-inkeep-chat.cjs"),E=require("../../../types/message.cjs");function L(u,p,g){const[l,R]=n.useState([]),[h,A]=n.useState(new Map),[d,k]=n.useState(Date.now()),[D,y]=n.useState(!1),S=n.useRef(0),x=n.useRef(0),w=n.useRef([]),f=n.useRef(h);f.current=h;const C=n.useCallback(()=>{const t=[];let e="",o=[],c=!1;u.length>S.current&&(k(Date.now()),S.current=u.length),x.current=0;const m=new Map,i=(s=!1)=>{if(o.length>0){const r=`group-${x.current++}`,a=f.current.get(r);a?m.set(r,{...a,isCompleted:s}):m.set(r,{isCompleted:s}),t.push({type:"summary-group",summaries:[...o],groupKey:r}),o=[]}};for(const s of u)if(s.type==="text")i(!0),e+=s.text||"";else if(s.type==="data-summary")e.trim()&&(t.push({type:"text",text:e}),e=""),o.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":i(!0);break;case"error":{i(!0);const a=r.message||"Unknown error";console.warn("Data operation error:",a),g(new Error(a)),c||(t.push({type:"text",text:v.DEFAULT_ERROR_MESSAGE}),c=!0);break}default:{const{type:a,label:b}=r;o.push({type:a,label:b});break}}}else if(s.type==="data-artifact")if(s.data?.type?.toLowerCase()===E.CITATION_ARTIFACT_TYPE){const r=s.data,a=r.artifactSummary||{title:r.name};e+=` ^${a?.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=""),i(!0),t.push(s));return i(!p),e.trim()&&t.push({type:"text",text:e}),{processed:t,newTimings:m}},[u,p,g]);n.useEffect(()=>{if(w.current===u)return;w.current=u;const{processed:t,newTimings:e}=C();R(t),(e.size!==f.current.size||Array.from(e.entries()).some(([c,m])=>{const i=f.current.get(c);return!i||i.isCompleted!==m.isCompleted}))&&A(e)},[C,u]);const T=n.useCallback(()=>{const t=Date.now()-d,e=Array.from(f.current.values()).some(c=>!c.isCompleted),o=t>1e3&&!e;y(o)},[d]);n.useEffect(()=>{if(!p){y(!1);return}if(!(l.length>0)){y(!1);return}const e=setInterval(T,200);return()=>clearInterval(e)},[p,T,l.length]);const P=n.useMemo(()=>!(l.length>0),[l.length]);return{processedParts:l,summaryTimings:h,shouldShowInitialLoading:P,shouldShowStreamDelayLoading:D}}exports.useStreamProcessor=L;
@@ -1,135 +1,103 @@
1
1
  "use client";
2
- import { useState as p, useRef as d, useCallback as R, useEffect as E, useMemo as F } from "react";
3
- import { DEFAULT_ERROR_MESSAGE as G } from "./use-inkeep-chat.js";
4
- import { useStreamingEvents as O } from "../../hooks/use-streaming-events.js";
5
- import { CITATION_ARTIFACT_TYPE as U } from "../../../types/message.js";
6
- function j(i, u, g) {
7
- const [m, L] = p([]), [h, P] = p(/* @__PURE__ */ new Map()), [w, b] = p(Date.now()), [M, y] = p(!1), x = d(0), k = d(0), S = d([]), f = d(h);
8
- f.current = h;
9
- const { emitArtifactSaved: T, emitCompletion: C, emitAgentInitializing: A, emitTextDelta: D } = O(), v = R(() => {
10
- const n = [];
11
- let t = "", s = [], c = !1;
12
- i.length > x.current && (b(Date.now()), x.current = i.length), k.current = 0;
13
- const l = /* @__PURE__ */ new Map(), o = (e = !1) => {
14
- if (s.length > 0) {
15
- const r = `group-${k.current++}`, a = f.current.get(r);
16
- a ? l.set(r, {
17
- ...a,
18
- isCompleted: e
19
- }) : l.set(r, {
20
- isCompleted: e
21
- }), n.push({
2
+ import { useState as p, useRef as h, useCallback as D, useEffect as R, useMemo as I } from "react";
3
+ import { DEFAULT_ERROR_MESSAGE as M } from "./use-inkeep-chat.js";
4
+ import { CITATION_ARTIFACT_TYPE as _ } from "../../../types/message.js";
5
+ function O(i, f, d) {
6
+ const [u, k] = p([]), [y, v] = p(/* @__PURE__ */ new Map()), [x, L] = p(Date.now()), [P, g] = p(!1), w = h(0), C = h(0), S = h([]), l = h(y);
7
+ l.current = y;
8
+ const T = D(() => {
9
+ const e = [];
10
+ let t = "", a = [], c = !1;
11
+ i.length > w.current && (L(Date.now()), w.current = i.length), C.current = 0;
12
+ const m = /* @__PURE__ */ new Map(), o = (r = !1) => {
13
+ if (a.length > 0) {
14
+ const s = `group-${C.current++}`, n = l.current.get(s);
15
+ n ? m.set(s, {
16
+ ...n,
17
+ isCompleted: r
18
+ }) : m.set(s, {
19
+ isCompleted: r
20
+ }), e.push({
22
21
  type: "summary-group",
23
- summaries: [...s],
24
- groupKey: r
25
- }), s = [];
22
+ summaries: [...a],
23
+ groupKey: s
24
+ }), a = [];
26
25
  }
27
26
  };
28
- for (const e of i)
29
- if (e.type === "text")
30
- o(!0), e.text && u && D(e.text), t += e.text || "";
31
- else if (e.type === "data-summary")
32
- t.trim() && (n.push({ type: "text", text: t }), t = ""), s.push(e.data);
33
- else if (e.type === "data-operation") {
34
- t.trim() && (n.push({ type: "text", text: t }), t = "");
35
- const r = e.data;
36
- if (r?.type)
37
- switch (r.type) {
38
- case "completion":
39
- C(
40
- "unknown",
41
- // No agent ID available in current structure
42
- 1
43
- // No iteration available in current structure
44
- ), o(!0);
45
- break;
27
+ for (const r of i)
28
+ if (r.type === "text")
29
+ o(!0), t += r.text || "";
30
+ else if (r.type === "data-summary")
31
+ t.trim() && (e.push({ type: "text", text: t }), t = ""), a.push(r.data);
32
+ else if (r.type === "data-operation") {
33
+ t.trim() && (e.push({ type: "text", text: t }), t = "");
34
+ const s = r.data;
35
+ if (s?.type)
36
+ switch (s.type) {
46
37
  case "agent_initializing":
47
- A(
48
- "unknown",
49
- // No session ID available in current structure
50
- "unknown"
51
- // No graph ID available in current structure
52
- );
38
+ break;
39
+ case "completion":
40
+ o(!0);
53
41
  break;
54
42
  case "error": {
55
43
  o(!0);
56
- const a = r.message || "Unknown error";
57
- console.warn("Data operation error:", a), g(new Error(a)), c || (n.push({ type: "text", text: G }), c = !0);
44
+ const n = s.message || "Unknown error";
45
+ console.warn("Data operation error:", n), d(new Error(n)), c || (e.push({ type: "text", text: M }), c = !0);
58
46
  break;
59
47
  }
60
48
  default: {
61
- const { type: a, label: z } = r;
62
- s.push({ type: a, label: z });
49
+ const { type: n, label: b } = s;
50
+ a.push({ type: n, label: b });
63
51
  break;
64
52
  }
65
53
  }
66
- } else if (e.type === "data-artifact")
67
- if (e.data?.type?.toLowerCase() === U) {
68
- const r = e.data, a = r.artifactSummary || {
69
- title: r.name
54
+ } else if (r.type === "data-artifact")
55
+ if (r.data?.type?.toLowerCase() === _) {
56
+ const s = r.data, n = s.artifactSummary || {
57
+ title: s.name
70
58
  };
71
- t += ` ^${a?.title || r.name}^`;
59
+ t += ` ^${n?.title || s.name}^`;
72
60
  } else
73
- t.trim() && (n.push({ type: "text", text: t }), t = ""), n.push(e), e.data && T(
74
- e.data.artifactId || "unknown",
75
- e.data.taskId || "unknown",
76
- "unknown",
77
- // toolCallId not available in current structure
78
- e.data.artifactType || "unknown",
79
- e.data.artifactSummary || {},
80
- // Use artifactSummary as summaryData
81
- {},
82
- // fullData not available in current structure
83
- { name: e.data.name, description: e.data.description }
84
- // Use available fields as metadata
85
- );
86
- else e.type === "data-component" && (t.trim() && (n.push({ type: "text", text: t }), t = ""), o(!0), n.push(e));
87
- return o(!u), t.trim() && n.push({ type: "text", text: t }), { processed: n, newTimings: l };
88
- }, [
89
- i,
90
- u,
91
- T,
92
- C,
93
- A,
94
- D,
95
- g
96
- ]);
97
- E(() => {
61
+ t.trim() && (e.push({ type: "text", text: t }), t = ""), e.push(r);
62
+ else r.type === "data-component" && (t.trim() && (e.push({ type: "text", text: t }), t = ""), o(!0), e.push(r));
63
+ return o(!f), t.trim() && e.push({ type: "text", text: t }), { processed: e, newTimings: m };
64
+ }, [i, f, d]);
65
+ R(() => {
98
66
  if (S.current === i)
99
67
  return;
100
68
  S.current = i;
101
- const { processed: n, newTimings: t } = v();
102
- L(n), (t.size !== f.current.size || Array.from(t.entries()).some(([c, l]) => {
103
- const o = f.current.get(c);
104
- return !o || o.isCompleted !== l.isCompleted;
105
- })) && P(t);
106
- }, [v, i]);
107
- const I = R(() => {
108
- const n = Date.now() - w, t = Array.from(f.current.values()).some(
69
+ const { processed: e, newTimings: t } = T();
70
+ k(e), (t.size !== l.current.size || Array.from(t.entries()).some(([c, m]) => {
71
+ const o = l.current.get(c);
72
+ return !o || o.isCompleted !== m.isCompleted;
73
+ })) && v(t);
74
+ }, [T, i]);
75
+ const A = D(() => {
76
+ const e = Date.now() - x, t = Array.from(l.current.values()).some(
109
77
  (c) => !c.isCompleted
110
- ), s = n > 1e3 && !t;
111
- y(s);
112
- }, [w]);
113
- E(() => {
114
- if (!u) {
115
- y(!1);
78
+ ), a = e > 1e3 && !t;
79
+ g(a);
80
+ }, [x]);
81
+ R(() => {
82
+ if (!f) {
83
+ g(!1);
116
84
  return;
117
85
  }
118
- if (!(m.length > 0)) {
119
- y(!1);
86
+ if (!(u.length > 0)) {
87
+ g(!1);
120
88
  return;
121
89
  }
122
- const t = setInterval(I, 200);
90
+ const t = setInterval(A, 200);
123
91
  return () => clearInterval(t);
124
- }, [u, I, m.length]);
125
- const _ = F(() => !(m.length > 0), [m.length]);
92
+ }, [f, A, u.length]);
93
+ const E = I(() => !(u.length > 0), [u.length]);
126
94
  return {
127
- processedParts: m,
128
- summaryTimings: h,
129
- shouldShowInitialLoading: _,
130
- shouldShowStreamDelayLoading: M
95
+ processedParts: u,
96
+ summaryTimings: y,
97
+ shouldShowInitialLoading: E,
98
+ shouldShowStreamDelayLoading: P
131
99
  };
132
100
  }
133
101
  export {
134
- j as useStreamProcessor
102
+ O as useStreamProcessor
135
103
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),p=require("../atoms/shadow/context.cjs");function x(){const c=p.useShadow()?.shadowHost,r=s.useRef(""),t=s.useCallback(e=>{if(!c){console.warn("useStreamingEvents: No host element available for event emission");return}const n={...e,conversationId:r.current,timestamp:Date.now()},a=new CustomEvent("streaming-event",{detail:n,bubbles:!0,composed:!0});c.dispatchEvent(a)},[c]),d=s.useCallback(e=>{r.current=e},[]),u=s.useCallback(e=>{t({kind:"text:delta",data:{text:e}})},[t]),m=s.useCallback((e,n,a)=>{t({kind:"stream:error",data:{message:e,agent:n,severity:"error",code:a}})},[t]),k=s.useCallback((e,n)=>{t({kind:"agent:reasoning",data:{agentId:e,parts:n}})},[t]),g=s.useCallback((e,n,a)=>{t({kind:"agent:generate",data:{agentId:e,parts:n,generationType:a}})},[t]),b=s.useCallback((e,n,a,o,i,l)=>{t({kind:"tool:execution",data:{agentId:e,toolName:n,args:a,result:o,toolId:i,duration:l}})},[t]),v=s.useCallback((e,n,a,o)=>{t({kind:"agent:transfer",data:{fromAgent:e,targetAgent:n,reason:a,context:o}})},[t]),C=s.useCallback((e,n,a,o,i)=>{t({kind:"delegation:sent",data:{delegationId:e,fromAgent:n,targetAgent:a,taskDescription:o,context:i}})},[t]),f=s.useCallback((e,n,a,o)=>{t({kind:"delegation:returned",data:{delegationId:e,fromAgent:n,targetAgent:a,result:o}})},[t]),E=s.useCallback((e,n,a,o,i,l,w)=>{t({kind:"artifact:saved",data:{artifactId:e,taskId:n,toolCallId:a,artifactType:o,summaryData:i,fullData:l,metadata:w}})},[t]),S=s.useCallback((e,n)=>{t({kind:"completion",data:{agent:e,iteration:n}})},[t]),h=s.useCallback((e,n)=>{t({kind:"agent:initializing",data:{sessionId:e,graphId:n}})},[t]);return{emitEvent:t,setConversationId:d,emitTextDelta:u,emitStreamError:m,emitAgentReasoning:k,emitAgentGenerate:g,emitToolExecution:b,emitAgentTransfer:v,emitDelegationSent:C,emitDelegationReturned:f,emitArtifactSaved:E,emitCompletion:S,emitAgentInitializing:h}}exports.useStreamingEvents=x;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),u=require("../atoms/shadow/context.cjs");function i(){const e=u.useShadow()?.shadowHost,s=n.useRef(""),o=n.useCallback(t=>{s.current=t},[]),r=n.useCallback((t,a)=>{if(!e){console.warn("useStreamingEvents: No host element available for parent event emission");return}const c=new CustomEvent(`ikp-${t}`,{detail:{...a,conversationId:s.current,timestamp:Date.now()},bubbles:!0,composed:!0});e.dispatchEvent(c)},[e]);return{setConversationId:o,emitToParent:r}}exports.useStreamingEvents=i;
@@ -1,140 +1,33 @@
1
1
  "use client";
2
- import { useRef as x, useCallback as o } from "react";
3
- import { useShadow as A } from "../atoms/shadow/context.js";
4
- function R() {
5
- const r = A()?.shadowHost, c = x(""), e = o(
6
- (t) => {
7
- if (!r) {
8
- console.warn("useStreamingEvents: No host element available for event emission");
2
+ import { useRef as c, useCallback as o } from "react";
3
+ import { useShadow as u } from "../atoms/shadow/context.js";
4
+ function v() {
5
+ const e = u()?.shadowHost, n = c(""), s = o((t) => {
6
+ n.current = t;
7
+ }, []), r = o(
8
+ (t, a) => {
9
+ if (!e) {
10
+ console.warn("useStreamingEvents: No host element available for parent event emission");
9
11
  return;
10
12
  }
11
- const n = {
12
- ...t,
13
- conversationId: c.current,
14
- timestamp: Date.now()
15
- }, a = new CustomEvent("streaming-event", {
16
- detail: n,
13
+ const i = new CustomEvent(`ikp-${t}`, {
14
+ detail: {
15
+ ...a,
16
+ conversationId: n.current,
17
+ timestamp: Date.now()
18
+ },
17
19
  bubbles: !0,
18
- // Allow event to bubble up
19
20
  composed: !0
20
- // Allow event to escape Shadow DOM boundary
21
- });
22
- r.dispatchEvent(a);
23
- },
24
- [r]
25
- ), m = o((t) => {
26
- c.current = t;
27
- }, []), l = o(
28
- (t) => {
29
- e({
30
- kind: "text:delta",
31
- data: { text: t }
32
- });
33
- },
34
- [e]
35
- ), u = o(
36
- (t, n, a) => {
37
- e({
38
- kind: "stream:error",
39
- data: {
40
- message: t,
41
- agent: n,
42
- severity: "error",
43
- code: a
44
- }
45
- });
46
- },
47
- [e]
48
- ), g = o(
49
- (t, n) => {
50
- e({
51
- kind: "agent:reasoning",
52
- data: { agentId: t, parts: n }
53
- });
54
- },
55
- [e]
56
- ), v = o(
57
- (t, n, a) => {
58
- e({
59
- kind: "agent:generate",
60
- data: { agentId: t, parts: n, generationType: a }
61
- });
62
- },
63
- [e]
64
- ), f = o(
65
- (t, n, a, i, s, d) => {
66
- e({
67
- kind: "tool:execution",
68
- data: { agentId: t, toolName: n, args: a, result: i, toolId: s, duration: d }
69
- });
70
- },
71
- [e]
72
- ), k = o(
73
- (t, n, a, i) => {
74
- e({
75
- kind: "agent:transfer",
76
- data: { fromAgent: t, targetAgent: n, reason: a, context: i }
77
- });
78
- },
79
- [e]
80
- ), E = o(
81
- (t, n, a, i, s) => {
82
- e({
83
- kind: "delegation:sent",
84
- data: { delegationId: t, fromAgent: n, targetAgent: a, taskDescription: i, context: s }
85
- });
86
- },
87
- [e]
88
- ), p = o(
89
- (t, n, a, i) => {
90
- e({
91
- kind: "delegation:returned",
92
- data: { delegationId: t, fromAgent: n, targetAgent: a, result: i }
93
- });
94
- },
95
- [e]
96
- ), h = o(
97
- (t, n, a, i, s, d, b) => {
98
- e({
99
- kind: "artifact:saved",
100
- data: { artifactId: t, taskId: n, toolCallId: a, artifactType: i, summaryData: s, fullData: d, metadata: b }
101
- });
102
- },
103
- [e]
104
- ), w = o(
105
- (t, n) => {
106
- e({
107
- kind: "completion",
108
- data: { agent: t, iteration: n }
109
- });
110
- },
111
- [e]
112
- ), S = o(
113
- (t, n) => {
114
- e({
115
- kind: "agent:initializing",
116
- data: { sessionId: t, graphId: n }
117
21
  });
22
+ e.dispatchEvent(i);
118
23
  },
119
24
  [e]
120
25
  );
121
26
  return {
122
- emitEvent: e,
123
- setConversationId: m,
124
- // Convenience methods
125
- emitTextDelta: l,
126
- emitStreamError: u,
127
- emitAgentReasoning: g,
128
- emitAgentGenerate: v,
129
- emitToolExecution: f,
130
- emitAgentTransfer: k,
131
- emitDelegationSent: E,
132
- emitDelegationReturned: p,
133
- emitArtifactSaved: h,
134
- emitCompletion: w,
135
- emitAgentInitializing: S
27
+ setConversationId: s,
28
+ emitToParent: r
136
29
  };
137
30
  }
138
31
  export {
139
- R as useStreamingEvents
32
+ v as useStreamingEvents
140
33
  };
@@ -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.14.12",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.14.13",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.14.12",
8
+ widgetLibraryVersion: "0.14.13",
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"),x=t=>{const{type:s,label:r}=t;return r||s.replace(/_/g," ").replace(/\b\w/g,l=>l.toUpperCase())},h={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_execution: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"}),default:e.jsx(a.Dot,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"})},d={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"}),default:e.jsx(a.Dot,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),...h},p=n.memo(({summary:t,index:s,showConnector:r})=>{const l=n.useMemo(()=>t.details?JSON.stringify(t.details,null,2):null,[t.details]),o=n.useMemo(()=>x(t),[t]),i=n.useMemo(()=>d[t.type]||d.default,[t.type]);return e.jsxs("div",{className:"flex items-start gap-2 text-xs relative",children:[r&&e.jsx("div",{className:"absolute left-1.5 top-4 bottom-0 w-px bg-gray-200 dark:bg-white-alpha-200 -mb-3"}),e.jsx("div",{className:"flex items-center justify-center w-3 h-3 relative z-10 mt-0.5",children:i}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:" text-gray-700 dark:text-white-alpha-600",children:o}),l&&e.jsx("pre",{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:l})]})]},`op-${t.type}-${s}`)}),m=n.memo(({summaries:t,isCompleted:s})=>{const[r,l]=n.useState(!s);n.useEffect(()=>{let i;return s?i=setTimeout(()=>{l(!1)},1e3):l(!0),()=>{i&&clearTimeout(i)}},[s]);const o=n.useCallback(()=>{l(!r)},[r]);return e.jsxs("div",{className:"flex flex-col items-start mb-2.5 mt-2.5 first:mt-1 relative",children:[e.jsx("button",{type:"button",onClick:o,"data-expanded":r,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:s?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("span",{className:"font-medium",children:"Completed"})]}):e.jsxs(e.Fragment,{children:[e.jsx(a.LoaderCircle,{className:"w-3 h-3 animate-spin"}),e.jsx("span",{className:"font-medium",children:"Thinking..."})]})}),e.jsx("div",{"data-expanded":r,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("div",{className:"pb-2 mt-1.5 space-y-3 relative",children:t.map((i,c)=>e.jsx(p,{summary:i,index:c,showConnector:t.length>1&&c<t.length-1},`op-${i.type}-${c}`))})})]})});exports.DataSummaryGroup=m;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),t=require("lucide-react"),x=a=>{const{type:s,label:r}=a;return r||s.replace(/_/g," ").replace(/\b\w/g,l=>l.toUpperCase())},d={agent_generate:e.jsx(t.RefreshCw,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),agent_reasoning:e.jsx(t.Brain,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),tool_call:e.jsx(t.Hammer,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),tool_result:e.jsx(t.Hammer,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),transfer:e.jsx(t.ArrowRight,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),delegation_sent:e.jsx(t.Forward,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),delegation_returned:e.jsx(t.CheckCheck,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),artifact_saved:e.jsx(t.Download,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),error:e.jsx(t.TriangleAlert,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),agent_initializing:e.jsx(t.CircleDot,{className:"w-3 h-3 animate-spin"}),completion:e.jsx(t.CheckCheck,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),default:e.jsx(t.Dot,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"})},h={retrieve:e.jsx(t.Search,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),action:e.jsx(t.CheckCheck,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),default:e.jsx(t.Dot,{className:"w-3 h-3 text-gray-500 dark:text-white-alpha-500"}),...d},p=n.memo(({summary:a,index:s,showConnector:r})=>{const l=n.useMemo(()=>a.details?JSON.stringify(a.details,null,2):null,[a.details]),o=n.useMemo(()=>x(a),[a]),i=n.useMemo(()=>h[a.type]||h.default,[a.type]);return e.jsxs("div",{className:"flex items-start gap-2 text-xs relative",children:[r&&e.jsx("div",{className:"absolute left-1.5 top-4 bottom-0 w-px bg-gray-200 dark:bg-white-alpha-200 -mb-3"}),e.jsx("div",{className:"flex items-center justify-center w-3 h-3 relative z-10 mt-0.5",children:i}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:" text-gray-700 dark:text-white-alpha-600",children:o}),l&&e.jsx("pre",{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:l})]})]},`op-${a.type}-${s}`)}),m=n.memo(({summaries:a,isCompleted:s})=>{const[r,l]=n.useState(!s);n.useEffect(()=>{let i;return s?i=setTimeout(()=>{l(!1)},1e3):l(!0),()=>{i&&clearTimeout(i)}},[s]);const o=n.useCallback(()=>{l(!r)},[r]);return e.jsxs("div",{className:"flex flex-col items-start mb-2.5 mt-2.5 first:mt-1 relative",children:[e.jsx("button",{type:"button",onClick:o,"data-expanded":r,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:s?e.jsxs(e.Fragment,{children:[e.jsx(t.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(t.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("span",{className:"font-medium",children:"Completed"})]}):e.jsxs(e.Fragment,{children:[e.jsx(t.LoaderCircle,{className:"w-3 h-3 animate-spin"}),e.jsx("span",{className:"font-medium",children:"Thinking..."})]})}),e.jsx("div",{"data-expanded":r,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("div",{className:"pb-2 mt-1.5 space-y-3 relative",children:a.map((i,c)=>e.jsx(p,{summary:i,index:c,showConnector:a.length>1&&c<a.length-1},`op-${i.type}-${c}`))})})]})});exports.DataSummaryGroup=m;
@@ -1,27 +1,31 @@
1
1
  "use client";
2
- import { jsxs as s, jsx as e, Fragment as c } from "react/jsx-runtime";
3
- import { memo as p, useState as g, useEffect as w, useCallback as u, useMemo as d } from "react";
4
- import { Check as f, ChevronRight as y, LoaderCircle as N, Dot as x, CheckCheck as m, Search as k, Download as v, Forward as b, ArrowRight as _, Hammer as C, Brain as S, RefreshCw as A } from "lucide-react";
5
- const E = (t) => {
2
+ import { jsxs as s, jsx as e, Fragment as h } from "react/jsx-runtime";
3
+ import { memo as m, useState as w, useEffect as u, useCallback as y, useMemo as c } from "react";
4
+ import { Check as f, ChevronRight as N, LoaderCircle as k, Dot as g, CheckCheck as d, Search as v, CircleDot as b, TriangleAlert as _, Download as C, Forward as S, ArrowRight as A, Hammer as p, Brain as D, RefreshCw as E } from "lucide-react";
5
+ const I = (t) => {
6
6
  const { type: r, label: a } = t;
7
7
  return a || r.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
8
- }, I = {
9
- agent_generate: /* @__PURE__ */ e(A, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
10
- agent_reasoning: /* @__PURE__ */ e(S, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
11
- tool_execution: /* @__PURE__ */ e(C, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
12
- transfer: /* @__PURE__ */ e(_, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
13
- delegation_sent: /* @__PURE__ */ e(b, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
14
- delegation_returned: /* @__PURE__ */ e(m, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
15
- artifact_saved: /* @__PURE__ */ e(v, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
16
- default: /* @__PURE__ */ e(x, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" })
17
- }, h = {
18
- retrieve: /* @__PURE__ */ e(k, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
19
- action: /* @__PURE__ */ e(m, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
20
- default: /* @__PURE__ */ e(x, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
21
- ...I
22
- }, M = p(({ summary: t, index: r, showConnector: a }) => {
23
- const l = d(() => t.details ? JSON.stringify(t.details, null, 2) : null, [t.details]), n = d(() => E(t), [t]), i = d(
24
- () => h[t.type] || h.default,
8
+ }, M = {
9
+ agent_generate: /* @__PURE__ */ e(E, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
10
+ agent_reasoning: /* @__PURE__ */ e(D, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
11
+ tool_call: /* @__PURE__ */ e(p, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
12
+ tool_result: /* @__PURE__ */ e(p, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
13
+ transfer: /* @__PURE__ */ e(A, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
14
+ delegation_sent: /* @__PURE__ */ e(S, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
15
+ delegation_returned: /* @__PURE__ */ e(d, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
16
+ artifact_saved: /* @__PURE__ */ e(C, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
17
+ error: /* @__PURE__ */ e(_, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
18
+ agent_initializing: /* @__PURE__ */ e(b, { className: "w-3 h-3 animate-spin" }),
19
+ completion: /* @__PURE__ */ e(d, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
20
+ default: /* @__PURE__ */ e(g, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" })
21
+ }, x = {
22
+ retrieve: /* @__PURE__ */ e(v, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
23
+ action: /* @__PURE__ */ e(d, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
24
+ default: /* @__PURE__ */ e(g, { className: "w-3 h-3 text-gray-500 dark:text-white-alpha-500" }),
25
+ ...M
26
+ }, O = m(({ summary: t, index: r, showConnector: a }) => {
27
+ const l = c(() => t.details ? JSON.stringify(t.details, null, 2) : null, [t.details]), n = c(() => I(t), [t]), i = c(
28
+ () => x[t.type] || x.default,
25
29
  [t.type]
26
30
  );
27
31
  return /* @__PURE__ */ s("div", { className: "flex items-start gap-2 text-xs relative", children: [
@@ -32,9 +36,9 @@ const E = (t) => {
32
36
  l && /* @__PURE__ */ e("pre", { 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: l })
33
37
  ] })
34
38
  ] }, `op-${t.type}-${r}`);
35
- }), T = p(({ summaries: t, isCompleted: r }) => {
36
- const [a, l] = g(!r);
37
- w(() => {
39
+ }), j = m(({ summaries: t, isCompleted: r }) => {
40
+ const [a, l] = w(!r);
41
+ u(() => {
38
42
  let i;
39
43
  return r ? i = setTimeout(() => {
40
44
  l(!1);
@@ -42,7 +46,7 @@ const E = (t) => {
42
46
  i && clearTimeout(i);
43
47
  };
44
48
  }, [r]);
45
- const n = u(() => {
49
+ const n = y(() => {
46
50
  l(!a);
47
51
  }, [a]);
48
52
  return /* @__PURE__ */ s("div", { className: "flex flex-col items-start mb-2.5 mt-2.5 first:mt-1 relative", children: [
@@ -53,12 +57,12 @@ const E = (t) => {
53
57
  onClick: n,
54
58
  "data-expanded": a,
55
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",
56
- children: r ? /* @__PURE__ */ s(c, { children: [
60
+ children: r ? /* @__PURE__ */ s(h, { children: [
57
61
  /* @__PURE__ */ e(f, { 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" }),
58
- /* @__PURE__ */ e(y, { 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" }),
62
+ /* @__PURE__ */ e(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" }),
59
63
  /* @__PURE__ */ e("span", { className: "font-medium", children: "Completed" })
60
- ] }) : /* @__PURE__ */ s(c, { children: [
61
- /* @__PURE__ */ e(N, { className: "w-3 h-3 animate-spin" }),
64
+ ] }) : /* @__PURE__ */ s(h, { children: [
65
+ /* @__PURE__ */ e(k, { className: "w-3 h-3 animate-spin" }),
62
66
  /* @__PURE__ */ e("span", { className: "font-medium", children: "Thinking..." })
63
67
  ] })
64
68
  }
@@ -69,7 +73,7 @@ const E = (t) => {
69
73
  "data-expanded": a,
70
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",
71
75
  children: /* @__PURE__ */ e("div", { className: "pb-2 mt-1.5 space-y-3 relative", children: t.map((i, o) => /* @__PURE__ */ e(
72
- M,
76
+ O,
73
77
  {
74
78
  summary: i,
75
79
  index: o,
@@ -82,5 +86,5 @@ const E = (t) => {
82
86
  ] });
83
87
  });
84
88
  export {
85
- T as DataSummaryGroup
89
+ j as DataSummaryGroup
86
90
  };
@@ -317,7 +317,7 @@ export declare interface CustomIcons {
317
317
 
318
318
  export declare type DataParts = {
319
319
  operation: {
320
- type: 'error' | 'agent_initializing' | 'completion' | 'agent_generate' | 'agent_reasoning' | 'tool_execution' | 'transfer' | 'delegation_sent' | 'delegation_returned' | 'artifact_saved';
320
+ type: OperationType;
321
321
  ctx: Record<string, unknown>;
322
322
  message?: string;
323
323
  label?: string;
@@ -444,7 +444,7 @@ export declare interface InkeepAIChatSettings {
444
444
  /**
445
445
  * Headers for requests
446
446
  */
447
- headers: Record<string, string>;
447
+ headers?: Record<string, string>;
448
448
  /**
449
449
  * API key for requests
450
450
  */
@@ -1164,6 +1164,8 @@ export declare interface OpenUrlAction {
1164
1164
  url: string;
1165
1165
  }
1166
1166
 
1167
+ export declare type OperationType = 'error' | 'agent_initializing' | 'completion' | 'agent_generate' | 'agent_reasoning' | 'tool_call' | 'tool_result' | 'transfer' | 'delegation_sent' | 'delegation_returned' | 'artifact_saved';
1168
+
1167
1169
  declare type QueryCondition = {
1168
1170
  $eq: QueryValue;
1169
1171
  } | {
@@ -317,7 +317,7 @@ export declare interface CustomIcons {
317
317
 
318
318
  export declare type DataParts = {
319
319
  operation: {
320
- type: 'error' | 'agent_initializing' | 'completion' | 'agent_generate' | 'agent_reasoning' | 'tool_execution' | 'transfer' | 'delegation_sent' | 'delegation_returned' | 'artifact_saved';
320
+ type: OperationType;
321
321
  ctx: Record<string, unknown>;
322
322
  message?: string;
323
323
  label?: string;
@@ -444,7 +444,7 @@ export declare interface InkeepAIChatSettings {
444
444
  /**
445
445
  * Headers for requests
446
446
  */
447
- headers: Record<string, string>;
447
+ headers?: Record<string, string>;
448
448
  /**
449
449
  * API key for requests
450
450
  */
@@ -1164,6 +1164,8 @@ export declare interface OpenUrlAction {
1164
1164
  url: string;
1165
1165
  }
1166
1166
 
1167
+ export declare type OperationType = 'error' | 'agent_initializing' | 'completion' | 'agent_generate' | 'agent_reasoning' | 'tool_call' | 'tool_result' | 'transfer' | 'delegation_sent' | 'delegation_returned' | 'artifact_saved';
1168
+
1167
1169
  declare type QueryCondition = {
1168
1170
  $eq: QueryValue;
1169
1171
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-ui",
3
- "version": "0.14.12",
3
+ "version": "0.14.14",
4
4
  "description": "",
5
5
  "homepage": "",
6
6
  "repository": {
@@ -70,6 +70,7 @@
70
70
  "@zag-js/focus-trap": "^1.7.0",
71
71
  "@zag-js/presence": "^1.13.1",
72
72
  "@zag-js/react": "^1.13.1",
73
+ "@zag-js/remove-scroll": "^1.26.2",
73
74
  "ai": "5.0.5",
74
75
  "altcha-lib": "^1.2.0",
75
76
  "aria-hidden": "^1.2.4",