@inkeep/agents-ui 0.0.0-dev-20260508213807 → 0.0.0-dev-20260508233535

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