@inkeep/agents-ui 0.0.0-dev-20260508201702 → 0.0.0-dev-20260508211520

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 (21) hide show
  1. 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 +1 -0
  2. 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 +93 -0
  3. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.cjs +1 -0
  4. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js +49 -0
  5. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.cjs +1 -0
  6. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js +19 -0
  7. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.cjs +1 -0
  8. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js +28 -0
  9. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.cjs +1 -0
  10. package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.js +23 -0
  11. package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +2 -2
  12. package/dist/primitives/components/embedded-chat/use-inkeep-chat.d.ts +13 -0
  13. package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +181 -183
  14. package/dist/styled/components/ask-user-form.cjs +1 -0
  15. package/dist/styled/components/ask-user-form.d.ts +96 -0
  16. package/dist/styled/components/ask-user-form.js +672 -0
  17. package/dist/styled/components/message.cjs +1 -1
  18. package/dist/styled/components/message.js +272 -210
  19. package/dist/styled/inkeep.css.cjs +78 -0
  20. package/dist/styled/inkeep.css.js +78 -0
  21. package/package.json +2 -1
@@ -1,21 +1,22 @@
1
1
  "use client";
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 = {
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 = {
19
20
  "input-streaming": "Pending",
20
21
  "input-available": "Running",
21
22
  "approval-requested": "Awaiting Approval",
@@ -24,187 +25,239 @@ const Ee = {
24
25
  "output-error": "Error",
25
26
  "output-denied": "Denied"
26
27
  };
27
- function Pe(t) {
28
- if (!t || typeof t != "object") return !1;
29
- const a = t;
28
+ function Oe(e) {
29
+ if (!e || typeof e != "object") return !1;
30
+ const a = e;
30
31
  return typeof a.type == "string" && a.type.startsWith("tool-");
31
32
  }
32
- const je = (t) => {
33
- if (!t || typeof t != "object" || !("status" in t)) return;
34
- const a = t.status;
33
+ const $e = (e) => {
34
+ if (!e || typeof e != "object" || !("status" in e)) return;
35
+ const a = e.status;
35
36
  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(
37
+ }, Pe = () => /* @__PURE__ */ t("div", { className: "flex space-x-1", children: [0, 1, 2].map((e) => /* @__PURE__ */ t(
37
38
  "span",
38
39
  {
39
40
  className: "animate-bounce-dot opacity-30",
40
41
  style: {
41
- animationDelay: `${t * 0.2}s`
42
+ animationDelay: `${e * 0.2}s`
42
43
  },
43
44
  children: "."
44
45
  },
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 })
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 })
51
52
  ] }),
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 })
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 })
53
54
  ] }),
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,
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,
57
58
  componentDef: a,
58
- renderText: i,
59
+ renderText: l,
59
60
  approvalId: s,
60
- messagePartsLength: u,
61
+ messagePartsLength: d,
61
62
  setApprovalDelayPending: n,
62
- addToolApprovalResponse: c,
63
- sendMessage: d,
64
- conversationId: f
63
+ addToolApprovalResponse: u,
64
+ addToolOutput: p,
65
+ sendMessage: y,
66
+ conversationId: o
65
67
  }) => {
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 } }));
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 } }));
75
79
  },
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 });
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 });
79
132
  };
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(
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(
82
135
  "span",
83
136
  {
84
- className: y(
137
+ className: k(
85
138
  "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"
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"
87
140
  ),
88
- children: t ? "true" : "false"
141
+ children: e ? "true" : "false"
89
142
  }
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) });
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) });
91
144
  }
92
- const Q = ({
93
- name: t,
145
+ const se = ({
146
+ name: e,
94
147
  value: a,
95
- isArrayIndex: i,
148
+ isArrayIndex: l,
96
149
  depth: s = 0
97
150
  }) => {
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(
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(
102
155
  "span",
103
156
  {
104
- className: y(
157
+ className: k(
105
158
  "font-medium shrink-0",
106
- i ? "text-gray-300 dark:text-white-alpha-300" : "text-gray-500 dark:text-white-alpha-500"
159
+ l ? "text-gray-300 dark:text-white-alpha-300" : "text-gray-500 dark:text-white-alpha-500"
107
160
  ),
108
- children: i ? "—" : t
161
+ children: l ? "—" : e
109
162
  }
110
163
  ),
111
- /* @__PURE__ */ e("span", { className: "min-w-0", children: J(a) })
164
+ /* @__PURE__ */ t("span", { className: "min-w-0", children: ne(a) })
112
165
  ] });
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(
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(
119
172
  "button",
120
173
  {
121
174
  type: "button",
122
- onClick: (p) => {
123
- p.stopPropagation(), n(!u);
175
+ onClick: (m) => {
176
+ m.stopPropagation(), n(!d);
124
177
  },
125
178
  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
179
  children: [
127
- /* @__PURE__ */ e(
128
- G,
180
+ /* @__PURE__ */ t(
181
+ te,
129
182
  {
130
- className: y(
183
+ className: k(
131
184
  "h-3.5 w-3.5 text-gray-400 dark:text-white-alpha-400 shrink-0 transition-transform",
132
- !u && "-rotate-90"
185
+ !d && "-rotate-90"
133
186
  )
134
187
  }
135
188
  ),
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" : ""}` })
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" : ""}` })
138
191
  ]
139
192
  }
140
193
  ),
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)) })
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)) })
142
195
  ] });
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(
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(
154
207
  "button",
155
208
  {
156
209
  type: "button",
157
210
  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,
211
+ onClick: () => m(!c),
212
+ "aria-expanded": c,
213
+ "data-expanded": c,
161
214
  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(we, { className: "w-3 h-3 text-gray-600 dark:text-white-alpha-600" }),
164
- /* @__PURE__ */ e("span", { children: u })
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 })
165
218
  ] }) }),
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: [
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: [
168
221
  (() => {
169
222
  switch (n) {
170
223
  case "input-streaming":
171
- return /* @__PURE__ */ e(Se, { className: "w-3 h-3" });
224
+ return /* @__PURE__ */ t(_e, { className: "w-3 h-3" });
172
225
  case "input-available":
173
- return /* @__PURE__ */ e(De, { className: "w-3 h-3 animate-spin" });
226
+ return /* @__PURE__ */ t(Ee, { className: "w-3 h-3 animate-spin" });
174
227
  case "approval-requested":
175
- return /* @__PURE__ */ e(Ce, { className: "w-3 h-3" });
228
+ return /* @__PURE__ */ t(De, { className: "w-3 h-3" });
176
229
  case "approval-responded":
177
- return /* @__PURE__ */ e(W, { className: "w-3 h-3" });
230
+ return /* @__PURE__ */ t(Z, { className: "w-3 h-3" });
178
231
  case "output-available":
179
- return /* @__PURE__ */ e(W, { className: "w-3 h-3" });
232
+ return /* @__PURE__ */ t(Z, { className: "w-3 h-3" });
180
233
  case "output-error":
181
- return /* @__PURE__ */ e(ve, { className: "w-3 h-3" });
234
+ return /* @__PURE__ */ t(Se, { className: "w-3 h-3" });
182
235
  case "output-denied":
183
- return /* @__PURE__ */ e(Ne, { className: "w-3 h-3" });
236
+ return /* @__PURE__ */ t(Te, { className: "w-3 h-3" });
184
237
  default:
185
238
  return null;
186
239
  }
187
240
  })(),
188
241
  h
189
242
  ] }),
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" })
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" })
191
244
  ] })
192
245
  ]
193
246
  }
194
247
  ),
195
- /* @__PURE__ */ o(
248
+ /* @__PURE__ */ i(
196
249
  "div",
197
250
  {
198
- "data-expanded": m,
199
- className: y(
251
+ "data-expanded": c,
252
+ className: k(
200
253
  "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"
201
254
  ),
202
255
  children: [
203
- /* @__PURE__ */ e(
256
+ /* @__PURE__ */ t(
204
257
  "div",
205
258
  {
206
- "data-expanded": m,
207
- className: y(
259
+ "data-expanded": c,
260
+ className: k(
208
261
  "relative",
209
262
  'before:content-[""] before:absolute before:inset-x-0 before:top-0 before:h-3 before:pointer-events-none before:z-10',
210
263
  'after:content-[""] after:absolute after:inset-x-0 after:bottom-0 after:h-3 after:pointer-events-none after:z-10',
@@ -212,89 +265,97 @@ const Q = ({
212
265
  "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
266
  "data-[expanded=false]:before:opacity-0 data-[expanded=false]:after:opacity-0"
214
267
  ),
215
- children: /* @__PURE__ */ e(
268
+ children: /* @__PURE__ */ t(
216
269
  "div",
217
270
  {
218
- "data-expanded": m,
219
- className: y(
271
+ "data-expanded": c,
272
+ className: k(
220
273
  "[scrollbar-width:thin] px-4",
221
274
  "data-[expanded=true]:max-h-48 data-[expanded=true]:overflow-y-auto"
222
275
  ),
223
- children: a.input != null && /* @__PURE__ */ e("div", { className: "text-xs py-2", children: /* @__PURE__ */ e(Y, { value: a.input }) })
276
+ children: a.input != null && /* @__PURE__ */ t("div", { className: "text-xs py-2", children: /* @__PURE__ */ t(oe, { value: a.input }) })
224
277
  }
225
278
  )
226
279
  }
227
280
  ),
228
- f && c && /* @__PURE__ */ o("div", { className: "flex justify-end gap-2 pt-1 pb-3 px-4", children: [
229
- /* @__PURE__ */ e(
281
+ y && u && /* @__PURE__ */ i("div", { className: "flex justify-end gap-2 pt-1 pb-3 px-4", children: [
282
+ /* @__PURE__ */ t(
230
283
  "button",
231
284
  {
232
285
  type: "button",
233
- className: y(
234
- X({ size: "xs", variant: "outline" }),
286
+ className: k(
287
+ ee({ size: "xs", variant: "outline" }),
235
288
  "px-2 py-1 rounded-md text-xs text-gray-700 dark:text-white-alpha-700"
236
289
  ),
237
- onClick: () => i(!1),
290
+ onClick: () => l(!1),
238
291
  children: "Deny"
239
292
  }
240
293
  ),
241
- /* @__PURE__ */ o(
294
+ /* @__PURE__ */ i(
242
295
  "button",
243
296
  {
244
297
  type: "button",
245
- className: y(
246
- X({ size: "xs", variant: "primaryFilled" }),
298
+ className: k(
299
+ ee({ size: "xs", variant: "primaryFilled" }),
247
300
  "px-2 py-1 rounded-md text-xs gap-1"
248
301
  ),
249
- onClick: () => i(!0),
302
+ onClick: () => l(!0),
250
303
  children: [
251
- /* @__PURE__ */ e(K, { className: "w-3 h-3" }),
304
+ /* @__PURE__ */ t(Q, { className: "w-3 h-3" }),
252
305
  "Approve"
253
306
  ]
254
307
  }
255
308
  )
256
309
  ] }),
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
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
260
313
  ] }),
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" }),
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" }),
263
316
  h
264
317
  ] })
265
318
  ]
266
319
  }
267
320
  )
268
321
  ] });
269
- }, Ze = ({
270
- className: t,
322
+ }, nt = ({
323
+ className: e,
271
324
  componentStyles: a,
272
- children: i,
325
+ children: l,
273
326
  isLast: s,
274
- ...u
327
+ ...d
275
328
  }) => {
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);
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);
282
343
  return;
283
344
  }
284
- return _(!1), g.current && clearTimeout(g.current), g.current = window.setTimeout(() => {
285
- _(!0);
345
+ return q(!1), b.current && clearTimeout(b.current), b.current = window.setTimeout(() => {
346
+ q(!0);
286
347
  }, 1e3), () => {
287
- g.current && (clearTimeout(g.current), g.current = null);
348
+ b.current && (clearTimeout(b.current), b.current = null);
288
349
  };
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 ?? {}),
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 ?? {}),
294
355
  [a]
295
- ), B = P(
356
+ ), J = S(
296
357
  (r, x) => {
297
- c({
358
+ u({
298
359
  eventName: "assistant_message_inline_link_opened",
299
360
  properties: {
300
361
  title: x?.toString(),
@@ -302,107 +363,108 @@ const Q = ({
302
363
  }
303
364
  });
304
365
  },
305
- [c]
306
- ), F = P(
366
+ [u]
367
+ ), Y = S(
307
368
  (r, x) => {
308
- c({
369
+ u({
309
370
  eventName: "assistant_code_block_copied",
310
371
  properties: {
311
- conversationId: d,
372
+ conversationId: p,
312
373
  language: r,
313
374
  code: x
314
375
  }
315
376
  });
316
377
  },
317
- [c, d]
318
- ), $ = P(
319
- (r) => /* @__PURE__ */ e(
320
- me,
378
+ [u, p]
379
+ ), F = S(
380
+ (r) => /* @__PURE__ */ t(
381
+ fe,
321
382
  {
322
383
  text: r,
323
- componentStyles: V,
324
- onLinkClick: B,
325
- onCodeCopy: F,
326
- artifacts: U
384
+ componentStyles: H,
385
+ onLinkClick: J,
386
+ onCodeCopy: Y,
387
+ artifacts: G
327
388
  }
328
389
  ),
329
- [V, B, F, U]
330
- ), se = E(
331
- () => y(
390
+ [H, J, Y, G]
391
+ ), le = $(
392
+ () => k(
332
393
  "data-[role=user]:whitespace-pre-wrap mb-3 data-[role=user]:mb-0 [&[data-role=user]>p]:mb-0 max-w-full",
333
- t
394
+ e
334
395
  ),
335
- [t]
336
- ), oe = !z || n.parts.some(
396
+ [e]
397
+ ), de = !z || n.parts.some(
337
398
  (r) => r.type === "text" && r.text?.trim()
338
399
  );
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 = {
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 = {
343
404
  "data-role": n.role,
344
405
  "data-type": r?.type === "data-component" ? r.data.type : r?.type,
345
- ...u,
346
- className: se
406
+ ...d,
407
+ className: le
347
408
  };
348
409
  switch (r?.type) {
349
410
  case "text":
350
- return /* @__PURE__ */ e(S, { ...k, children: z ? r.text : $(r.text || "") }, x);
411
+ return /* @__PURE__ */ t(j, { ...A, children: z ? r.text : F(r.text || "") }, x);
351
412
  case "data-component": {
352
- const { type: w } = r.data;
353
- switch (w) {
413
+ const { type: N } = r.data;
414
+ switch (N) {
354
415
  case "text":
355
- return /* @__PURE__ */ e("div", { ...k, children: $(r.data.text || "") }, x);
416
+ return /* @__PURE__ */ t("div", { ...A, children: F(r.data.text || "") }, x);
356
417
  default: {
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}`);
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}`);
359
420
  }
360
421
  }
361
422
  }
362
423
  case "data-artifact": {
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}`);
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}`);
367
428
  }
368
429
  case "summary-group": {
369
- const w = te.get(r.groupKey) || {
430
+ const N = D.get(r.groupKey) || {
370
431
  isCompleted: !1
371
432
  };
372
- return /* @__PURE__ */ e(S, { ...k, children: /* @__PURE__ */ e(
373
- ye,
433
+ return /* @__PURE__ */ t(j, { ...A, children: /* @__PURE__ */ t(
434
+ ke,
374
435
  {
375
436
  summaries: r.summaries || [],
376
- isCompleted: w.isCompleted
437
+ isCompleted: N.isCompleted
377
438
  }
378
439
  ) }, `${r.groupKey}-${x}`);
379
440
  }
380
441
  default: {
381
- if (!Pe(r))
442
+ if (!Oe(r))
382
443
  return null;
383
- const w = r, N = r.approval?.id;
384
- return Z || N ? /* @__PURE__ */ e(S, { ...k, children: /* @__PURE__ */ e(
385
- $e,
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,
386
447
  {
387
- tool: w,
388
- componentDef: v?.IkpTool,
389
- renderText: $,
390
- approvalId: N,
448
+ tool: N,
449
+ componentDef: O?.IkpTool,
450
+ renderText: F,
451
+ approvalId: T,
391
452
  messagePartsLength: n.parts.length,
392
- setApprovalDelayPending: q,
393
- addToolApprovalResponse: p,
394
- sendMessage: h,
395
- conversationId: d
453
+ setApprovalDelayPending: X,
454
+ addToolApprovalResponse: m,
455
+ addToolOutput: h,
456
+ sendMessage: g,
457
+ conversationId: p
396
458
  }
397
459
  ) }, r.toolCallId ?? `${r.type}-${x}`) : null;
398
460
  }
399
461
  }
400
462
  }),
401
- ae && /* @__PURE__ */ e(be, {}),
402
- (re || ne) && /* @__PURE__ */ e(Le, {})
463
+ K && /* @__PURE__ */ t(ve, {}),
464
+ (C || ie) && /* @__PURE__ */ t(Pe, {})
403
465
  ] });
404
466
  };
405
467
  export {
406
- Me as DefaultToolComponent,
407
- Ze as EmbeddedChatMessagePart
468
+ ze as DefaultToolComponent,
469
+ nt as EmbeddedChatMessagePart
408
470
  };