@inkeep/agents-ui 0.14.13 → 0.14.15
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 +14 -11
- package/dist/index.d.ts +14 -11
- package/dist/primitives/atoms/dialog.cjs +1 -1
- package/dist/primitives/atoms/dialog.js +129 -131
- package/dist/primitives/components/embedded-chat/use-stream-processor.cjs +1 -1
- package/dist/primitives/components/embedded-chat/use-stream-processor.js +35 -33
- package/dist/primitives/components/embedded-chat.cjs +4 -4
- package/dist/primitives/components/embedded-chat.js +262 -258
- package/dist/primitives/providers/base-events-provider.cjs +1 -1
- package/dist/primitives/providers/base-events-provider.js +1 -1
- package/dist/styled/components/data-summary-group.cjs +1 -1
- package/dist/styled/components/data-summary-group.js +35 -31
- package/dist/types/types.d.cts +3 -1
- package/dist/types/types.d.ts +3 -1
- package/package.json +2 -1
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"),
|
|
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
|
|
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
|
|
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
|
|
14
|
+
import { Primitive as g } from "@radix-ui/react-primitive";
|
|
15
15
|
import { useFocusGuards as H } from "@radix-ui/react-focus-guards";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
const P = "Dialog", [
|
|
20
|
-
const { __scopeDialog: n, children: r, open: s, defaultOpen: e, onOpenChange:
|
|
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:
|
|
23
|
+
onChange: o
|
|
24
24
|
});
|
|
25
25
|
return /* @__PURE__ */ c(
|
|
26
|
-
|
|
26
|
+
z,
|
|
27
27
|
{
|
|
28
28
|
scope: n,
|
|
29
29
|
triggerRef: p,
|
|
30
|
-
contentRef:
|
|
31
|
-
contentId:
|
|
32
|
-
titleId:
|
|
33
|
-
descriptionId:
|
|
34
|
-
open:
|
|
35
|
-
onOpenChange:
|
|
36
|
-
onOpenToggle: i.useCallback(() =>
|
|
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
|
-
|
|
43
|
-
const
|
|
44
|
-
(
|
|
45
|
-
const { __scopeDialog: r, ...s } =
|
|
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
|
-
|
|
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":
|
|
53
|
+
"data-state": h(e.open),
|
|
54
54
|
...s,
|
|
55
|
-
ref:
|
|
56
|
-
onClick: D(
|
|
55
|
+
ref: o,
|
|
56
|
+
onClick: D(t.onClick, e.onOpenToggle)
|
|
57
57
|
}
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
60
|
);
|
|
61
|
-
|
|
62
|
-
const
|
|
61
|
+
J.displayName = N;
|
|
62
|
+
const y = "DialogPortal", [Q, w] = v(y, {
|
|
63
63
|
forceMount: void 0
|
|
64
|
-
}),
|
|
65
|
-
const { __scopeDialog: n, forceMount: r, children: s, container: e } =
|
|
66
|
-
return /* @__PURE__ */ c(
|
|
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
|
-
|
|
69
|
-
const
|
|
70
|
-
(
|
|
71
|
-
const r =
|
|
72
|
-
return
|
|
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
|
-
|
|
76
|
-
const
|
|
77
|
-
(
|
|
78
|
-
const { __scopeDialog: r, ...s } =
|
|
79
|
-
return (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
),
|
|
104
|
-
(
|
|
105
|
-
const r =
|
|
106
|
-
return /* @__PURE__ */ c(O, { present: s ||
|
|
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
|
-
|
|
110
|
-
const
|
|
111
|
-
(
|
|
112
|
-
const r = l(
|
|
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
|
|
115
|
-
if (
|
|
111
|
+
const o = s.current;
|
|
112
|
+
if (o) {
|
|
116
113
|
const a = document.querySelectorAll("[data-ikp-component]");
|
|
117
|
-
return
|
|
114
|
+
return K([o, ...Array.from(a)]);
|
|
118
115
|
}
|
|
119
116
|
}, []), /* @__PURE__ */ c(
|
|
120
|
-
|
|
117
|
+
b,
|
|
121
118
|
{
|
|
122
|
-
...
|
|
119
|
+
...t,
|
|
123
120
|
ref: e,
|
|
124
121
|
trapFocus: r.open,
|
|
125
122
|
disableOutsidePointerEvents: !0,
|
|
126
|
-
onPointerDownOutside: D(
|
|
127
|
-
const a =
|
|
128
|
-
(a.button === 2 || p) &&
|
|
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
|
-
|
|
132
|
-
(
|
|
128
|
+
t.onFocusOutside,
|
|
129
|
+
(o) => o.preventDefault()
|
|
133
130
|
)
|
|
134
131
|
}
|
|
135
132
|
);
|
|
136
133
|
}
|
|
137
|
-
),
|
|
138
|
-
(
|
|
139
|
-
const r = l(
|
|
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
|
-
|
|
138
|
+
b,
|
|
142
139
|
{
|
|
143
|
-
...
|
|
140
|
+
...t,
|
|
144
141
|
ref: n,
|
|
145
142
|
trapFocus: !1,
|
|
146
143
|
disableOutsidePointerEvents: !1,
|
|
147
|
-
onInteractOutside: (
|
|
148
|
-
|
|
149
|
-
const a =
|
|
150
|
-
r.triggerRef.current?.contains(a) &&
|
|
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
|
-
),
|
|
156
|
-
(
|
|
157
|
-
const { __scopeDialog: r, trapFocus: s, onOpenAutoFocus: e, onCloseAutoFocus:
|
|
158
|
-
return H(),
|
|
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(
|
|
157
|
+
return q(d.current, {
|
|
161
158
|
preventScroll: !0,
|
|
162
159
|
onActivate: e,
|
|
163
|
-
onDeactivate:
|
|
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":
|
|
171
|
+
"data-state": h(p.open),
|
|
174
172
|
...a,
|
|
175
|
-
ref:
|
|
173
|
+
ref: m,
|
|
176
174
|
onDismiss: () => p.onOpenChange(!1)
|
|
177
175
|
}
|
|
178
176
|
);
|
|
179
177
|
}
|
|
180
|
-
),
|
|
181
|
-
(
|
|
182
|
-
const { __scopeDialog: r, ...s } =
|
|
183
|
-
return /* @__PURE__ */ c(
|
|
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
|
-
|
|
187
|
-
const
|
|
188
|
-
(
|
|
189
|
-
const { __scopeDialog: r, ...s } =
|
|
190
|
-
return /* @__PURE__ */ c(
|
|
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
|
-
|
|
194
|
-
const
|
|
195
|
-
(
|
|
196
|
-
const { __scopeDialog: r, ...s } =
|
|
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
|
-
|
|
196
|
+
g.button,
|
|
199
197
|
{
|
|
200
198
|
type: "button",
|
|
201
199
|
...s,
|
|
202
200
|
ref: n,
|
|
203
|
-
onClick: D(
|
|
201
|
+
onClick: D(t.onClick, () => e.onOpenChange(!1))
|
|
204
202
|
}
|
|
205
203
|
);
|
|
206
204
|
}
|
|
207
205
|
);
|
|
208
|
-
|
|
209
|
-
function
|
|
210
|
-
return
|
|
206
|
+
G.displayName = L;
|
|
207
|
+
function h(t) {
|
|
208
|
+
return t ? "open" : "closed";
|
|
211
209
|
}
|
|
212
|
-
const
|
|
210
|
+
const Rt = x, _t = T, Ot = A, Pt = M, yt = F, ht = G;
|
|
213
211
|
export {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),
|
|
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,51 +1,53 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useState as p, useRef as h, useCallback as D, useEffect as R, useMemo as
|
|
3
|
-
import { DEFAULT_ERROR_MESSAGE as
|
|
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
4
|
import { CITATION_ARTIFACT_TYPE as _ } from "../../../types/message.js";
|
|
5
|
-
function
|
|
6
|
-
const [u,
|
|
7
|
-
|
|
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
8
|
const T = D(() => {
|
|
9
9
|
const e = [];
|
|
10
|
-
let t = "",
|
|
11
|
-
i.length > w.current && (
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
14
|
-
const s = `group-${C.current++}`, n =
|
|
15
|
-
n ?
|
|
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
16
|
...n,
|
|
17
17
|
isCompleted: r
|
|
18
|
-
}) :
|
|
18
|
+
}) : m.set(s, {
|
|
19
19
|
isCompleted: r
|
|
20
20
|
}), e.push({
|
|
21
21
|
type: "summary-group",
|
|
22
|
-
summaries: [...
|
|
22
|
+
summaries: [...a],
|
|
23
23
|
groupKey: s
|
|
24
|
-
}),
|
|
24
|
+
}), a = [];
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
for (const r of i)
|
|
28
28
|
if (r.type === "text")
|
|
29
|
-
|
|
29
|
+
o(!0), t += r.text || "";
|
|
30
30
|
else if (r.type === "data-summary")
|
|
31
|
-
t.trim() && (e.push({ type: "text", text: t }), t = ""),
|
|
31
|
+
t.trim() && (e.push({ type: "text", text: t }), t = ""), a.push(r.data);
|
|
32
32
|
else if (r.type === "data-operation") {
|
|
33
33
|
t.trim() && (e.push({ type: "text", text: t }), t = "");
|
|
34
34
|
const s = r.data;
|
|
35
35
|
if (s?.type)
|
|
36
36
|
switch (s.type) {
|
|
37
|
+
case "agent_initializing":
|
|
38
|
+
break;
|
|
37
39
|
case "completion":
|
|
38
|
-
|
|
40
|
+
o(!0);
|
|
39
41
|
break;
|
|
40
42
|
case "error": {
|
|
41
|
-
|
|
43
|
+
o(!0);
|
|
42
44
|
const n = s.message || "Unknown error";
|
|
43
|
-
console.warn("Data operation error:", n), d(new Error(n)), c || (e.push({ type: "text", text:
|
|
45
|
+
console.warn("Data operation error:", n), d(new Error(n)), c || (e.push({ type: "text", text: M }), c = !0);
|
|
44
46
|
break;
|
|
45
47
|
}
|
|
46
48
|
default: {
|
|
47
|
-
const { type: n, label:
|
|
48
|
-
|
|
49
|
+
const { type: n, label: b } = s;
|
|
50
|
+
a.push({ type: n, label: b });
|
|
49
51
|
break;
|
|
50
52
|
}
|
|
51
53
|
}
|
|
@@ -57,24 +59,24 @@ function z(i, f, d) {
|
|
|
57
59
|
t += ` ^${n?.title || s.name}^`;
|
|
58
60
|
} else
|
|
59
61
|
t.trim() && (e.push({ type: "text", text: t }), t = ""), e.push(r);
|
|
60
|
-
else r.type === "data-component" && (t.trim() && (e.push({ type: "text", text: t }), t = ""),
|
|
61
|
-
return
|
|
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 };
|
|
62
64
|
}, [i, f, d]);
|
|
63
65
|
R(() => {
|
|
64
66
|
if (S.current === i)
|
|
65
67
|
return;
|
|
66
68
|
S.current = i;
|
|
67
69
|
const { processed: e, newTimings: t } = T();
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
return !
|
|
71
|
-
})) &&
|
|
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);
|
|
72
74
|
}, [T, i]);
|
|
73
75
|
const A = D(() => {
|
|
74
|
-
const e = Date.now() - x, t = Array.from(
|
|
76
|
+
const e = Date.now() - x, t = Array.from(l.current.values()).some(
|
|
75
77
|
(c) => !c.isCompleted
|
|
76
|
-
),
|
|
77
|
-
g(
|
|
78
|
+
), a = e > 1e3 && !t;
|
|
79
|
+
g(a);
|
|
78
80
|
}, [x]);
|
|
79
81
|
R(() => {
|
|
80
82
|
if (!f) {
|
|
@@ -88,14 +90,14 @@ function z(i, f, d) {
|
|
|
88
90
|
const t = setInterval(A, 200);
|
|
89
91
|
return () => clearInterval(t);
|
|
90
92
|
}, [f, A, u.length]);
|
|
91
|
-
const E =
|
|
93
|
+
const E = I(() => !(u.length > 0), [u.length]);
|
|
92
94
|
return {
|
|
93
95
|
processedParts: u,
|
|
94
96
|
summaryTimings: y,
|
|
95
97
|
shouldShowInitialLoading: E,
|
|
96
|
-
shouldShowStreamDelayLoading:
|
|
98
|
+
shouldShowStreamDelayLoading: P
|
|
97
99
|
};
|
|
98
100
|
}
|
|
99
101
|
export {
|
|
100
|
-
|
|
102
|
+
O as useStreamProcessor
|
|
101
103
|
};
|