@inkeep/agents-ui 0.15.29 → 0.16.0
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.cjs +1 -1
- package/dist/index.js +157 -158
- package/dist/primitives/atoms/markdown/index.cjs +1 -1
- package/dist/primitives/atoms/markdown/index.js +41 -39
- package/dist/primitives/components/embedded-chat.cjs +4 -4
- package/dist/primitives/components/embedded-chat.d.ts +5 -14
- package/dist/primitives/components/embedded-chat.js +800 -849
- package/dist/primitives/hooks/use-feedback-api.cjs +1 -0
- package/dist/primitives/hooks/use-feedback-api.d.ts +19 -0
- package/dist/primitives/hooks/use-feedback-api.js +37 -0
- package/dist/primitives/hooks/use-simple-scroll.cjs +1 -1
- package/dist/primitives/hooks/use-simple-scroll.d.ts +7 -0
- package/dist/primitives/hooks/use-simple-scroll.js +33 -30
- package/dist/primitives/index.cjs +1 -1
- package/dist/primitives/index.js +134 -136
- package/dist/primitives/providers/base-events-provider.cjs +1 -1
- package/dist/primitives/providers/base-events-provider.js +1 -1
- package/dist/primitives/providers/feedback-provider.cjs +1 -1
- package/dist/primitives/providers/feedback-provider.d.ts +1 -1
- package/dist/primitives/providers/feedback-provider.js +57 -64
- package/dist/primitives/providers/index.cjs +1 -1
- package/dist/primitives/providers/index.d.ts +0 -1
- package/dist/primitives/providers/index.js +42 -45
- package/dist/primitives/utils/component-ids.cjs +1 -1
- package/dist/primitives/utils/component-ids.d.ts +2 -6
- package/dist/primitives/utils/component-ids.js +1 -3
- package/dist/primitives/utils/default-settings.cjs +1 -1
- package/dist/primitives/utils/default-settings.d.ts +1 -0
- package/dist/primitives/utils/default-settings.js +6 -5
- package/dist/primitives/utils/misc.cjs +5 -1
- package/dist/primitives/utils/misc.d.ts +2 -1
- package/dist/primitives/utils/misc.js +45 -20
- package/dist/react/embedded-chat.cjs +1 -1
- package/dist/react/embedded-chat.js +249 -264
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +157 -158
- package/dist/styled/components/embedded-chat.cjs +1 -1
- package/dist/styled/components/embedded-chat.d.ts +2 -4
- package/dist/styled/components/embedded-chat.js +381 -411
- package/dist/styled/components/index.cjs +1 -1
- package/dist/styled/components/index.js +12 -11
- package/dist/styled/components/message.cjs +1 -1
- package/dist/styled/components/message.d.ts +20 -0
- package/dist/styled/components/message.js +304 -230
- package/dist/styled/index.cjs +1 -1
- package/dist/styled/index.js +155 -156
- package/dist/styled/inkeep.css.cjs +79 -12
- package/dist/styled/inkeep.css.js +79 -12
- package/dist/types/config/ai.d.ts +7 -0
- package/dist/types/events.d.ts +3 -17
- package/package.json +1 -1
- package/dist/primitives/providers/feedback-item-provider.cjs +0 -1
- package/dist/primitives/providers/feedback-item-provider.d.ts +0 -10
- package/dist/primitives/providers/feedback-item-provider.js +0 -16
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as e, jsxs as
|
|
3
|
-
import { useBaseEvents as
|
|
4
|
-
import { useInkeepConfig as
|
|
5
|
-
import { useMessage as
|
|
6
|
-
import { EmbeddedChatPrimitiveMarkdown as
|
|
7
|
-
import { useChat as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
2
|
+
import { jsx as e, jsxs as o, Fragment as ie } from "react/jsx-runtime";
|
|
3
|
+
import { useBaseEvents as le } from "../../primitives/providers/base-events-provider.js";
|
|
4
|
+
import { useInkeepConfig as de } from "../../primitives/providers/config-provider.js";
|
|
5
|
+
import { useMessage as pe } from "../../primitives/providers/message-provider.js";
|
|
6
|
+
import { EmbeddedChatPrimitiveMarkdown as ce, PrimitiveMessagePart as D } from "../../primitives/components/embedded-chat.js";
|
|
7
|
+
import { useChat as me } from "../../primitives/components/embedded-chat/chat-provider.js";
|
|
8
|
+
import { isCitationArtifact as ue } from "../../primitives/utils/misc.js";
|
|
9
|
+
import { merge as he } from "merge-anything";
|
|
10
|
+
import { cn as y } from "../utils.js";
|
|
11
|
+
import { markdownStyles as xe } from "./ui/markdown-styles.js";
|
|
12
|
+
import { useStreamProcessor as fe } from "../../primitives/components/embedded-chat/use-stream-processor.js";
|
|
13
|
+
import { DataSummaryGroup as ge } from "./data-summary-group.js";
|
|
14
|
+
import { useState as L, useRef as A, useEffect as $, useMemo as E, useCallback as P } from "react";
|
|
15
|
+
import { DynamicComponent as M, MessageLoading as ye } from "./embedded-chat.js";
|
|
16
|
+
import { Hammer as be, ChevronDown as X, Check as F, X as we, Library as ke, ComponentIcon as Ne, XCircle as ve, TriangleAlert as Ce, CheckCircle as K, Clock as Se, Loader2 as De, Circle as Te } from "lucide-react";
|
|
17
|
+
import { button as W } from "./ui/recipes/button.js";
|
|
18
|
+
const Ae = {
|
|
18
19
|
"input-streaming": "Pending",
|
|
19
20
|
"input-available": "Running",
|
|
20
21
|
"approval-requested": "Awaiting Approval",
|
|
@@ -23,312 +24,385 @@ const Ne = {
|
|
|
23
24
|
"output-error": "Error",
|
|
24
25
|
"output-denied": "Denied"
|
|
25
26
|
};
|
|
26
|
-
function
|
|
27
|
-
if (!
|
|
28
|
-
const
|
|
29
|
-
return typeof
|
|
27
|
+
function Ee(t) {
|
|
28
|
+
if (!t || typeof t != "object") return !1;
|
|
29
|
+
const a = t;
|
|
30
|
+
return typeof a.type == "string" && a.type.startsWith("tool-");
|
|
30
31
|
}
|
|
31
|
-
const
|
|
32
|
-
if (!
|
|
33
|
-
const
|
|
34
|
-
return typeof
|
|
35
|
-
},
|
|
32
|
+
const Pe = (t) => {
|
|
33
|
+
if (!t || typeof t != "object" || !("status" in t)) return;
|
|
34
|
+
const a = t.status;
|
|
35
|
+
return typeof a == "string" ? a : void 0;
|
|
36
|
+
}, Le = () => /* @__PURE__ */ e("div", { className: "flex space-x-1", children: [0, 1, 2].map((t) => /* @__PURE__ */ e(
|
|
36
37
|
"span",
|
|
37
38
|
{
|
|
38
39
|
className: "animate-bounce-dot opacity-30",
|
|
39
40
|
style: {
|
|
40
|
-
animationDelay: `${
|
|
41
|
+
animationDelay: `${t * 0.2}s`
|
|
41
42
|
},
|
|
42
43
|
children: "."
|
|
43
44
|
},
|
|
44
|
-
|
|
45
|
-
)) }), G = ({ name:
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
/* @__PURE__ */ e(
|
|
49
|
-
/* @__PURE__ */ e("span", { children:
|
|
45
|
+
t
|
|
46
|
+
)) }), G = ({ name: t, Icon: a, props: i, componentType: s }) => /* @__PURE__ */ o("div", { className: "border rounded-lg bg-gray-50 dark:bg-gray-dark-800 mb-3", children: [
|
|
47
|
+
/* @__PURE__ */ o("div", { className: "flex justify-between px-4 py-2 text-xs", children: [
|
|
48
|
+
/* @__PURE__ */ o("div", { className: "font-medium flex items-center gap-2", children: [
|
|
49
|
+
/* @__PURE__ */ e(a, { className: "w-3 h-3 text-gray-600 dark:text-white-alpha-600" }),
|
|
50
|
+
/* @__PURE__ */ e("span", { children: t })
|
|
50
51
|
] }),
|
|
51
|
-
/* @__PURE__ */ e("div", { className: "flex items-center px-1.5 py-0.5 rounded-md text-2xs uppercase tracking-wider bg-gray-200 dark:bg-white-alpha-200 font-medium text-gray-700 dark:text-white-alpha-700 font-mono", children:
|
|
52
|
+
/* @__PURE__ */ e("div", { className: "flex items-center px-1.5 py-0.5 rounded-md text-2xs uppercase tracking-wider bg-gray-200 dark:bg-white-alpha-200 font-medium text-gray-700 dark:text-white-alpha-700 font-mono", children: s })
|
|
52
53
|
] }),
|
|
53
|
-
/* @__PURE__ */ e("pre", { className: "whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 font-mono px-4 py-2", children: JSON.stringify(
|
|
54
|
-
] }),
|
|
55
|
-
tool:
|
|
56
|
-
componentDef:
|
|
57
|
-
renderText:
|
|
58
|
-
approvalId:
|
|
59
|
-
messagePartsLength:
|
|
60
|
-
setApprovalDelayPending:
|
|
61
|
-
addToolApprovalResponse:
|
|
62
|
-
sendMessage:
|
|
63
|
-
conversationId:
|
|
54
|
+
/* @__PURE__ */ e("pre", { className: "whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 font-mono px-4 py-2", children: JSON.stringify(i, null, 2) })
|
|
55
|
+
] }), je = ({ name: t, props: a }) => /* @__PURE__ */ e(G, { name: t, Icon: Ne, props: a, componentType: "component" }), Ie = ({ name: t, props: a }) => /* @__PURE__ */ e(G, { name: t, Icon: ke, props: a, componentType: "artifact" }), _e = ({
|
|
56
|
+
tool: t,
|
|
57
|
+
componentDef: a,
|
|
58
|
+
renderText: i,
|
|
59
|
+
approvalId: s,
|
|
60
|
+
messagePartsLength: u,
|
|
61
|
+
setApprovalDelayPending: n,
|
|
62
|
+
addToolApprovalResponse: c,
|
|
63
|
+
sendMessage: d,
|
|
64
|
+
conversationId: f
|
|
64
65
|
}) => {
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
async (
|
|
73
|
-
|
|
66
|
+
const l = A(d);
|
|
67
|
+
l.current = d;
|
|
68
|
+
const m = A(c);
|
|
69
|
+
m.current = c;
|
|
70
|
+
const p = A(n);
|
|
71
|
+
p.current = n;
|
|
72
|
+
const h = P(
|
|
73
|
+
async (j = !0) => {
|
|
74
|
+
s && (p.current({ partCount: u }), m.current({ id: s, approved: j }), await l.current(void 0, { body: { conversationId: f } }));
|
|
74
75
|
},
|
|
75
|
-
[
|
|
76
|
-
),
|
|
77
|
-
return /* @__PURE__ */ e(
|
|
78
|
-
}
|
|
79
|
-
|
|
76
|
+
[s, u, f]
|
|
77
|
+
), v = E(() => ({ tool: t, approve: h, renderMarkdown: i }), [t]);
|
|
78
|
+
return /* @__PURE__ */ e(a ? M : Me, { name: t.type, props: v, componentDef: a });
|
|
79
|
+
};
|
|
80
|
+
function H(t) {
|
|
81
|
+
return t === null ? /* @__PURE__ */ e("span", { className: "text-gray-500 dark:text-white-alpha-500 font-mono font-medium text-1xs", children: "null" }) : t === void 0 ? /* @__PURE__ */ e("span", { className: "text-gray-400 dark:text-white-alpha-400 italic text-xs font-medium", children: "undefined" }) : typeof t == "boolean" ? /* @__PURE__ */ e(
|
|
82
|
+
"span",
|
|
83
|
+
{
|
|
84
|
+
className: y(
|
|
85
|
+
"inline-flex font-mono font-semibold items-center px-1 py-0.5 text-1xs rounded-md border",
|
|
86
|
+
t ? "bg-inkeep-expanded-primary-50 border-inkeep-expanded-primary-200 text-inkeep-expanded-primary-600 dark:bg-inkeep-expanded-primary-950 dark:border-inkeep-expanded-primary-600 dark:text-inkeep-expanded-primary-200" : "bg-gray-100 dark:bg-white-alpha-50 text-gray-700 dark:text-white-alpha-700"
|
|
87
|
+
),
|
|
88
|
+
children: t ? "true" : "false"
|
|
89
|
+
}
|
|
90
|
+
) : typeof t == "number" ? /* @__PURE__ */ e("span", { className: "tabular-nums font-medium text-inkeep-expanded-primary-600 dark:text-inkeep-expanded-primary-200", children: t.toLocaleString() }) : typeof t == "string" ? /* @__PURE__ */ e("span", { className: "text-gray-800 dark:text-white-alpha-800 break-words", children: t }) : /* @__PURE__ */ e("span", { children: String(t) });
|
|
91
|
+
}
|
|
92
|
+
const J = ({
|
|
93
|
+
name: t,
|
|
94
|
+
value: a,
|
|
95
|
+
isArrayIndex: i,
|
|
96
|
+
depth: s = 0
|
|
97
|
+
}) => {
|
|
98
|
+
const [u, n] = L(s < 1), c = a !== null && typeof a == "object" && !Array.isArray(a), d = Array.isArray(a);
|
|
99
|
+
if (!(c || d))
|
|
100
|
+
return /* @__PURE__ */ o("div", { className: "flex items-baseline gap-2 py-1 text-xs", children: [
|
|
101
|
+
/* @__PURE__ */ e(
|
|
102
|
+
"span",
|
|
103
|
+
{
|
|
104
|
+
className: y(
|
|
105
|
+
"font-medium shrink-0",
|
|
106
|
+
i ? "text-gray-300 dark:text-white-alpha-300" : "text-gray-500 dark:text-white-alpha-500"
|
|
107
|
+
),
|
|
108
|
+
children: i ? "—" : t
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ e("span", { className: "min-w-0", children: H(a) })
|
|
112
|
+
] });
|
|
113
|
+
const l = d ? a.map((p, h) => [String(h), p]) : Object.entries(a);
|
|
114
|
+
return l.length === 0 ? /* @__PURE__ */ o("div", { className: "flex items-baseline gap-2 py-1 text-xs", children: [
|
|
115
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-gray-500 dark:text-white-alpha-500 shrink-0", children: t }),
|
|
116
|
+
/* @__PURE__ */ e("span", { className: "text-gray-400 dark:text-white-alpha-400 italic", children: d ? "empty list" : "empty" })
|
|
117
|
+
] }) : /* @__PURE__ */ o("div", { children: [
|
|
118
|
+
/* @__PURE__ */ o(
|
|
119
|
+
"button",
|
|
120
|
+
{
|
|
121
|
+
type: "button",
|
|
122
|
+
onClick: (p) => {
|
|
123
|
+
p.stopPropagation(), n(!u);
|
|
124
|
+
},
|
|
125
|
+
className: "flex items-center gap-1.5 py-1 text-xs hover:bg-gray-50 dark:hover:bg-white-alpha-50 -mx-1.5 px-1.5 rounded transition-colors w-full text-left",
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ e(
|
|
128
|
+
X,
|
|
129
|
+
{
|
|
130
|
+
className: y(
|
|
131
|
+
"h-3.5 w-3.5 text-gray-400 dark:text-white-alpha-400 shrink-0 transition-transform",
|
|
132
|
+
!u && "-rotate-90"
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-gray-500 dark:text-white-alpha-500", children: t }),
|
|
137
|
+
!u && /* @__PURE__ */ e("span", { className: "text-gray-400 dark:text-white-alpha-400 text-1xs ml-1", children: d ? `${l.length} item${l.length !== 1 ? "s" : ""}` : `${l.length} field${l.length !== 1 ? "s" : ""}` })
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
u && /* @__PURE__ */ e("div", { className: "border-l-2 border-gray-200 dark:border-white-alpha-200 ml-1.5 pl-3", children: l.map(([p, h]) => /* @__PURE__ */ e(J, { name: p, value: h, isArrayIndex: d, depth: s + 1 }, p)) })
|
|
142
|
+
] });
|
|
143
|
+
}, $e = ({ value: t }) => {
|
|
144
|
+
if (t == null || typeof t != "object")
|
|
145
|
+
return /* @__PURE__ */ e("span", { className: "text-xs", children: H(t) });
|
|
146
|
+
const a = Array.isArray(t) ? t.map((i, s) => [String(s), i]) : Object.entries(t);
|
|
147
|
+
return a.length === 0 ? /* @__PURE__ */ e("div", { className: "text-xs text-gray-400 dark:text-white-alpha-400 italic", children: "No arguments" }) : /* @__PURE__ */ e("div", { className: "space-y-1", children: a.map(([i, s]) => /* @__PURE__ */ e(J, { name: i, value: s, isArrayIndex: Array.isArray(t) }, i)) });
|
|
148
|
+
}, Me = ({ props: t }) => {
|
|
149
|
+
const { tool: a, approve: i } = t, s = a.type, u = s.startsWith("tool-") ? s.slice(5) : s, n = a.state, c = a.approval?.id, d = !!c, f = n === "approval-requested", l = Pe(a.output), [m, p] = L(d), h = n ? Ae[n] ?? n : "tool";
|
|
80
150
|
return $(() => {
|
|
81
|
-
f &&
|
|
82
|
-
}, [f]), /* @__PURE__ */
|
|
83
|
-
|
|
151
|
+
f && p(!0);
|
|
152
|
+
}, [f]), /* @__PURE__ */ o("div", { className: "border rounded-lg mb-3 overflow-hidden", children: [
|
|
153
|
+
/* @__PURE__ */ o(
|
|
84
154
|
"button",
|
|
85
155
|
{
|
|
86
156
|
type: "button",
|
|
87
|
-
className: "inline-flex items-center group gap-2 text-xs text-gray-700 dark:text-white-alpha-700 hover:text-gray-800 dark:hover:text-white-alpha-800 transition-colors cursor-pointer w-full justify-between px-4 py-2",
|
|
88
|
-
onClick: () =>
|
|
89
|
-
"
|
|
157
|
+
className: "inline-flex items-center group gap-2 text-xs text-gray-700 dark:text-white-alpha-700 hover:text-gray-800 dark:hover:text-white-alpha-800 transition-colors cursor-pointer w-full justify-between px-4 py-2 data-[expanded=true]:border-b",
|
|
158
|
+
onClick: () => p(!m),
|
|
159
|
+
"aria-expanded": m,
|
|
160
|
+
"data-expanded": m,
|
|
90
161
|
children: [
|
|
91
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */
|
|
92
|
-
/* @__PURE__ */ e(
|
|
93
|
-
/* @__PURE__ */ e("span", { children:
|
|
162
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ o("div", { className: "font-medium flex items-center gap-2", children: [
|
|
163
|
+
/* @__PURE__ */ e(be, { className: "w-3 h-3 text-gray-600 dark:text-white-alpha-600" }),
|
|
164
|
+
/* @__PURE__ */ e("span", { children: u })
|
|
94
165
|
] }) }),
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
/* @__PURE__ */
|
|
166
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
|
|
167
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-1.5 px-1.5 py-0.5 rounded-md text-2xs uppercase tracking-wider bg-gray-100 dark:bg-white-alpha-100 font-medium text-gray-700 dark:text-white-alpha-700 font-mono", children: [
|
|
97
168
|
(() => {
|
|
98
|
-
switch (
|
|
169
|
+
switch (n) {
|
|
99
170
|
case "input-streaming":
|
|
100
|
-
return /* @__PURE__ */ e(
|
|
171
|
+
return /* @__PURE__ */ e(Te, { className: "w-3 h-3" });
|
|
101
172
|
case "input-available":
|
|
102
|
-
return /* @__PURE__ */ e(
|
|
173
|
+
return /* @__PURE__ */ e(De, { className: "w-3 h-3 animate-spin" });
|
|
103
174
|
case "approval-requested":
|
|
104
|
-
return /* @__PURE__ */ e(
|
|
175
|
+
return /* @__PURE__ */ e(Se, { className: "w-3 h-3" });
|
|
105
176
|
case "approval-responded":
|
|
106
|
-
return /* @__PURE__ */ e(
|
|
177
|
+
return /* @__PURE__ */ e(K, { className: "w-3 h-3" });
|
|
107
178
|
case "output-available":
|
|
108
|
-
return /* @__PURE__ */ e(W, { className: "w-3 h-3" });
|
|
109
|
-
case "output-error":
|
|
110
179
|
return /* @__PURE__ */ e(K, { className: "w-3 h-3" });
|
|
180
|
+
case "output-error":
|
|
181
|
+
return /* @__PURE__ */ e(Ce, { className: "w-3 h-3" });
|
|
111
182
|
case "output-denied":
|
|
112
|
-
return /* @__PURE__ */ e(
|
|
183
|
+
return /* @__PURE__ */ e(ve, { className: "w-3 h-3" });
|
|
113
184
|
default:
|
|
114
185
|
return null;
|
|
115
186
|
}
|
|
116
187
|
})(),
|
|
117
|
-
|
|
188
|
+
h
|
|
118
189
|
] }),
|
|
119
|
-
/* @__PURE__ */ e(
|
|
190
|
+
/* @__PURE__ */ e(X, { className: "w-3.5 h-3.5 text-gray-500 dark:text-white-alpha-500 transition-all duration-200 transform rotate-0 group-data-[expanded=true]:rotate-180" })
|
|
120
191
|
] })
|
|
121
192
|
]
|
|
122
193
|
}
|
|
123
194
|
),
|
|
124
|
-
/* @__PURE__ */
|
|
195
|
+
/* @__PURE__ */ o(
|
|
125
196
|
"div",
|
|
126
197
|
{
|
|
127
|
-
"data-expanded":
|
|
128
|
-
className:
|
|
129
|
-
"
|
|
130
|
-
'before:content-[""] before:absolute before:inset-x-0 before:-top-px before:h-3 before:pointer-events-none before:z-10',
|
|
131
|
-
'after:content-[""] after:absolute after:inset-x-0 after:bottom-0 after:h-3 after:pointer-events-none after:z-10',
|
|
132
|
-
"before:bg-[linear-gradient(white,_transparent)] after:bg-[linear-gradient(transparent,_white)]",
|
|
133
|
-
"dark:before:bg-[linear-gradient(var(--ikp-color-gray-dark-950),_transparent)] dark:after:bg-[linear-gradient(transparent,_var(--ikp-color-gray-dark-950))]",
|
|
134
|
-
"data-[expanded=false]:before:opacity-0 data-[expanded=false]:after:opacity-0"
|
|
198
|
+
"data-expanded": m,
|
|
199
|
+
className: y(
|
|
200
|
+
"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"
|
|
135
201
|
),
|
|
136
|
-
children:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
202
|
+
children: [
|
|
203
|
+
/* @__PURE__ */ e(
|
|
204
|
+
"div",
|
|
205
|
+
{
|
|
206
|
+
"data-expanded": m,
|
|
207
|
+
className: y(
|
|
208
|
+
"relative",
|
|
209
|
+
'before:content-[""] before:absolute before:inset-x-0 before:top-0 before:h-3 before:pointer-events-none before:z-10',
|
|
210
|
+
'after:content-[""] after:absolute after:inset-x-0 after:bottom-0 after:h-3 after:pointer-events-none after:z-10',
|
|
211
|
+
"before:bg-[linear-gradient(white,_transparent)] after:bg-[linear-gradient(transparent,_white)]",
|
|
212
|
+
"dark:before:bg-[linear-gradient(var(--ikp-color-gray-dark-950),_transparent)] dark:after:bg-[linear-gradient(transparent,_var(--ikp-color-gray-dark-950))]",
|
|
213
|
+
"data-[expanded=false]:before:opacity-0 data-[expanded=false]:after:opacity-0"
|
|
214
|
+
),
|
|
215
|
+
children: /* @__PURE__ */ e(
|
|
216
|
+
"div",
|
|
217
|
+
{
|
|
218
|
+
"data-expanded": m,
|
|
219
|
+
className: y(
|
|
220
|
+
"[scrollbar-width:thin] px-4",
|
|
221
|
+
"data-[expanded=true]:max-h-48 data-[expanded=true]:overflow-y-auto"
|
|
222
|
+
),
|
|
223
|
+
children: a.input != null && /* @__PURE__ */ e("div", { className: "text-xs py-2", children: /* @__PURE__ */ e($e, { value: a.input }) })
|
|
224
|
+
}
|
|
225
|
+
)
|
|
226
|
+
}
|
|
227
|
+
),
|
|
228
|
+
f && c && /* @__PURE__ */ o("div", { className: "flex justify-end gap-2 pt-1 pb-3 px-4", children: [
|
|
229
|
+
/* @__PURE__ */ e(
|
|
230
|
+
"button",
|
|
231
|
+
{
|
|
232
|
+
type: "button",
|
|
233
|
+
className: y(
|
|
234
|
+
W({ size: "xs", variant: "outline" }),
|
|
235
|
+
"px-2 py-1 rounded-md text-xs text-gray-700 dark:text-white-alpha-700"
|
|
236
|
+
),
|
|
237
|
+
onClick: () => i(!1),
|
|
238
|
+
children: "Deny"
|
|
239
|
+
}
|
|
143
240
|
),
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
f && c && /* @__PURE__ */ i("div", { className: "flex justify-end gap-2 pt-1", children: [
|
|
152
|
-
/* @__PURE__ */ e(
|
|
153
|
-
"button",
|
|
154
|
-
{
|
|
155
|
-
type: "button",
|
|
156
|
-
className: T(
|
|
157
|
-
X({ size: "xs", variant: "outline" }),
|
|
158
|
-
"px-2 py-1 rounded-md text-xs text-gray-700 dark:text-white-alpha-700"
|
|
159
|
-
),
|
|
160
|
-
onClick: () => l(!1),
|
|
161
|
-
children: "Deny"
|
|
162
|
-
}
|
|
241
|
+
/* @__PURE__ */ o(
|
|
242
|
+
"button",
|
|
243
|
+
{
|
|
244
|
+
type: "button",
|
|
245
|
+
className: y(
|
|
246
|
+
W({ size: "xs", variant: "primaryFilled" }),
|
|
247
|
+
"px-2 py-1 rounded-md text-xs gap-1"
|
|
163
248
|
),
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
{
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
x === "approved" && /* @__PURE__ */ e(F, { className: "w-3 h-3" }),
|
|
182
|
-
x
|
|
183
|
-
] }),
|
|
184
|
-
s === "output-denied" && !r && /* @__PURE__ */ i("div", { className: "flex justify-end items-center gap-1 whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 capitalize", children: [
|
|
185
|
-
/* @__PURE__ */ e(ve, { className: "w-3 h-3" }),
|
|
186
|
-
g
|
|
187
|
-
] }),
|
|
188
|
-
s === "output-available" && n.output != null && r && /* @__PURE__ */ e("pre", { className: "whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 font-mono py-2", children: typeof n.output == "string" ? n.output : JSON.stringify(n.output, null, 2) })
|
|
189
|
-
]
|
|
190
|
-
}
|
|
191
|
-
)
|
|
249
|
+
onClick: () => i(!0),
|
|
250
|
+
children: [
|
|
251
|
+
/* @__PURE__ */ e(F, { className: "w-3 h-3" }),
|
|
252
|
+
"Approve"
|
|
253
|
+
]
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
] }),
|
|
257
|
+
n === "output-available" && l && a.output != null && /* @__PURE__ */ o("div", { className: "flex justify-end items-center gap-1 whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 capitalize pb-3 px-4", children: [
|
|
258
|
+
l === "approved" && /* @__PURE__ */ e(F, { className: "w-3 h-3" }),
|
|
259
|
+
l
|
|
260
|
+
] }),
|
|
261
|
+
n === "output-denied" && /* @__PURE__ */ o("div", { className: "flex justify-end items-center gap-1 whitespace-pre-wrap text-xs text-gray-700 dark:text-white-alpha-700 capitalize pb-3 px-4", children: [
|
|
262
|
+
/* @__PURE__ */ e(we, { className: "w-3 h-3" }),
|
|
263
|
+
h
|
|
264
|
+
] })
|
|
265
|
+
]
|
|
192
266
|
}
|
|
193
267
|
)
|
|
194
268
|
] });
|
|
195
|
-
},
|
|
196
|
-
className:
|
|
197
|
-
componentStyles:
|
|
198
|
-
children:
|
|
199
|
-
isLast:
|
|
200
|
-
...
|
|
269
|
+
}, Ze = ({
|
|
270
|
+
className: t,
|
|
271
|
+
componentStyles: a,
|
|
272
|
+
children: i,
|
|
273
|
+
isLast: s,
|
|
274
|
+
...u
|
|
201
275
|
}) => {
|
|
202
|
-
const { message:
|
|
203
|
-
aiChatSettings: { components:
|
|
204
|
-
} =
|
|
276
|
+
const { message: n } = pe(), { logEvent: c } = le(), { conversationId: d, isStreaming: f, isLoading: l, setError: m, addToolApprovalResponse: p, sendMessage: h } = me(), {
|
|
277
|
+
aiChatSettings: { components: v, artifacts: R, headers: j }
|
|
278
|
+
} = de(), Q = j?.["x-emit-operations"] === "true", O = n.role === "user", Y = (f || l) && s && n.role === "assistant", { processedParts: Z, summaryTimings: ee, shouldShowInitialLoading: te, shouldShowStreamDelayLoading: ae } = fe(n.parts, Y, m), [C, z] = L(null), [re, I] = L(!1), g = A(null);
|
|
205
279
|
$(() => {
|
|
206
|
-
if (!
|
|
207
|
-
|
|
280
|
+
if (!C) {
|
|
281
|
+
I(!1), g.current && (clearTimeout(g.current), g.current = null);
|
|
208
282
|
return;
|
|
209
283
|
}
|
|
210
|
-
return
|
|
211
|
-
|
|
284
|
+
return I(!1), g.current && clearTimeout(g.current), g.current = window.setTimeout(() => {
|
|
285
|
+
I(!0);
|
|
212
286
|
}, 1e3), () => {
|
|
213
|
-
|
|
287
|
+
g.current && (clearTimeout(g.current), g.current = null);
|
|
214
288
|
};
|
|
215
|
-
}, [
|
|
216
|
-
|
|
217
|
-
}, [
|
|
218
|
-
const q =
|
|
219
|
-
() =>
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
() => de(ue, r ?? {}),
|
|
225
|
-
[r]
|
|
226
|
-
), U = P(
|
|
227
|
-
(t, p) => {
|
|
228
|
-
s({
|
|
289
|
+
}, [C]), $(() => {
|
|
290
|
+
C && (!s || n.parts.length > C.partCount) && z(null);
|
|
291
|
+
}, [C, s, n.parts.length]);
|
|
292
|
+
const q = E(() => n.parts.filter(ue), [n.parts]), U = E(
|
|
293
|
+
() => he(xe, a ?? {}),
|
|
294
|
+
[a]
|
|
295
|
+
), V = P(
|
|
296
|
+
(r, x) => {
|
|
297
|
+
c({
|
|
229
298
|
eventName: "assistant_message_inline_link_opened",
|
|
230
299
|
properties: {
|
|
231
|
-
title:
|
|
232
|
-
url:
|
|
300
|
+
title: x?.toString(),
|
|
301
|
+
url: r
|
|
233
302
|
}
|
|
234
303
|
});
|
|
235
304
|
},
|
|
236
|
-
[
|
|
305
|
+
[c]
|
|
237
306
|
), B = P(
|
|
238
|
-
(
|
|
239
|
-
|
|
307
|
+
(r, x) => {
|
|
308
|
+
c({
|
|
240
309
|
eventName: "assistant_code_block_copied",
|
|
241
310
|
properties: {
|
|
242
|
-
conversationId:
|
|
243
|
-
language:
|
|
244
|
-
code:
|
|
311
|
+
conversationId: d,
|
|
312
|
+
language: r,
|
|
313
|
+
code: x
|
|
245
314
|
}
|
|
246
315
|
});
|
|
247
316
|
},
|
|
248
|
-
[
|
|
249
|
-
),
|
|
250
|
-
(
|
|
251
|
-
|
|
317
|
+
[c, d]
|
|
318
|
+
), _ = P(
|
|
319
|
+
(r) => /* @__PURE__ */ e(
|
|
320
|
+
ce,
|
|
252
321
|
{
|
|
253
|
-
text:
|
|
254
|
-
componentStyles:
|
|
255
|
-
onLinkClick:
|
|
322
|
+
text: r,
|
|
323
|
+
componentStyles: U,
|
|
324
|
+
onLinkClick: V,
|
|
256
325
|
onCodeCopy: B,
|
|
257
326
|
artifacts: q
|
|
258
327
|
}
|
|
259
328
|
),
|
|
260
|
-
[
|
|
261
|
-
),
|
|
262
|
-
() =>
|
|
329
|
+
[U, V, B, q]
|
|
330
|
+
), ne = E(
|
|
331
|
+
() => y(
|
|
263
332
|
"data-[role=user]:whitespace-pre-wrap mb-3 data-[role=user]:mb-0 [&[data-role=user]>p]:mb-0 max-w-full",
|
|
264
|
-
|
|
333
|
+
t
|
|
265
334
|
),
|
|
266
|
-
[
|
|
267
|
-
),
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
335
|
+
[t]
|
|
336
|
+
), se = !O || n.parts.some(
|
|
337
|
+
(r) => r.type === "text" && r.text?.trim()
|
|
338
|
+
);
|
|
339
|
+
return /* @__PURE__ */ o(ie, { children: [
|
|
340
|
+
!se && /* @__PURE__ */ e("span", { className: "text-gray-500 dark:text-white-alpha-500", children: "No message content" }),
|
|
341
|
+
Z.map((r, x) => {
|
|
342
|
+
const k = {
|
|
343
|
+
"data-role": n.role,
|
|
344
|
+
"data-type": r?.type === "data-component" ? r.data.type : r?.type,
|
|
345
|
+
...u,
|
|
346
|
+
className: ne
|
|
276
347
|
};
|
|
277
|
-
switch (
|
|
348
|
+
switch (r?.type) {
|
|
278
349
|
case "text":
|
|
279
|
-
return /* @__PURE__ */ e(
|
|
350
|
+
return /* @__PURE__ */ e(D, { ...k, children: O ? r.text : _(r.text || "") }, x);
|
|
280
351
|
case "data-component": {
|
|
281
|
-
const { type:
|
|
282
|
-
switch (
|
|
352
|
+
const { type: w } = r.data;
|
|
353
|
+
switch (w) {
|
|
283
354
|
case "text":
|
|
284
|
-
return /* @__PURE__ */ e("div", { ...
|
|
355
|
+
return /* @__PURE__ */ e("div", { ...k, children: _(r.data.text || "") }, x);
|
|
285
356
|
default: {
|
|
286
|
-
const
|
|
287
|
-
return /* @__PURE__ */ e(
|
|
357
|
+
const N = r.data, { name: b, props: T } = N, S = v?.[b];
|
|
358
|
+
return /* @__PURE__ */ e(D, { ...k, children: /* @__PURE__ */ e(S ? M : je, { name: b, props: T, componentDef: S }) }, `${b}-${x}`);
|
|
288
359
|
}
|
|
289
360
|
}
|
|
290
361
|
}
|
|
291
362
|
case "data-artifact": {
|
|
292
|
-
const
|
|
293
|
-
|
|
363
|
+
const w = r.data, { name: N, type: b, artifactSummary: T } = w;
|
|
364
|
+
if (b === "citation" && !T?.url) return null;
|
|
365
|
+
const S = R?.[b];
|
|
366
|
+
return /* @__PURE__ */ e(D, { ...k, children: /* @__PURE__ */ e(S ? M : Ie, { name: b, props: T, componentDef: S }) }, `${N}-${x}`);
|
|
294
367
|
}
|
|
295
368
|
case "summary-group": {
|
|
296
|
-
const
|
|
369
|
+
const w = ee.get(r.groupKey) || {
|
|
297
370
|
isCompleted: !1
|
|
298
371
|
};
|
|
299
|
-
return /* @__PURE__ */ e(
|
|
300
|
-
|
|
372
|
+
return /* @__PURE__ */ e(D, { ...k, children: /* @__PURE__ */ e(
|
|
373
|
+
ge,
|
|
301
374
|
{
|
|
302
|
-
summaries:
|
|
303
|
-
isCompleted:
|
|
375
|
+
summaries: r.summaries || [],
|
|
376
|
+
isCompleted: w.isCompleted
|
|
304
377
|
}
|
|
305
|
-
) }, `${
|
|
378
|
+
) }, `${r.groupKey}-${x}`);
|
|
306
379
|
}
|
|
307
380
|
default: {
|
|
308
|
-
if (!
|
|
381
|
+
if (!Ee(r))
|
|
309
382
|
return null;
|
|
310
|
-
const
|
|
311
|
-
return
|
|
312
|
-
|
|
383
|
+
const w = r, N = r.approval?.id;
|
|
384
|
+
return Q || N ? /* @__PURE__ */ e(D, { ...k, children: /* @__PURE__ */ e(
|
|
385
|
+
_e,
|
|
313
386
|
{
|
|
314
|
-
tool:
|
|
315
|
-
componentDef:
|
|
316
|
-
renderText:
|
|
317
|
-
approvalId:
|
|
318
|
-
messagePartsLength:
|
|
387
|
+
tool: w,
|
|
388
|
+
componentDef: v?.IkpTool,
|
|
389
|
+
renderText: _,
|
|
390
|
+
approvalId: N,
|
|
391
|
+
messagePartsLength: n.parts.length,
|
|
319
392
|
setApprovalDelayPending: z,
|
|
320
|
-
addToolApprovalResponse:
|
|
321
|
-
sendMessage:
|
|
322
|
-
conversationId:
|
|
393
|
+
addToolApprovalResponse: p,
|
|
394
|
+
sendMessage: h,
|
|
395
|
+
conversationId: d
|
|
323
396
|
}
|
|
324
|
-
) },
|
|
397
|
+
) }, r.toolCallId ?? `${r.type}-${x}`) : null;
|
|
325
398
|
}
|
|
326
399
|
}
|
|
327
400
|
}),
|
|
328
|
-
|
|
329
|
-
(
|
|
401
|
+
te && /* @__PURE__ */ e(ye, {}),
|
|
402
|
+
(ae || re) && /* @__PURE__ */ e(Le, {})
|
|
330
403
|
] });
|
|
331
404
|
};
|
|
332
405
|
export {
|
|
333
|
-
|
|
406
|
+
Me as DefaultToolComponent,
|
|
407
|
+
Ze as EmbeddedChatMessagePart
|
|
334
408
|
};
|