@inkeep/agents-ui 0.0.0-dev-20260404031321 → 0.0.0-dev-20260408193814

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