@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.
- 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
- 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
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.cjs +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js +49 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.cjs +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js +19 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.cjs +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js +28 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.cjs +1 -0
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.js +23 -0
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +2 -2
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.d.ts +13 -0
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +181 -183
- package/dist/styled/components/ask-user-form.cjs +1 -0
- package/dist/styled/components/ask-user-form.d.ts +96 -0
- package/dist/styled/components/ask-user-form.js +672 -0
- package/dist/styled/components/message.cjs +1 -1
- package/dist/styled/components/message.js +272 -210
- package/dist/styled/inkeep.css.cjs +78 -0
- package/dist/styled/inkeep.css.js +78 -0
- package/package.json +2 -1
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useBaseEvents as
|
|
4
|
-
import { useInkeepConfig as
|
|
5
|
-
import { useMessage as
|
|
6
|
-
import { EmbeddedChatPrimitiveMarkdown as
|
|
7
|
-
import { useChat as
|
|
8
|
-
import { isCitationArtifact as
|
|
9
|
-
import { merge as
|
|
10
|
-
import { cn as
|
|
11
|
-
import { markdownStyles as
|
|
12
|
-
import { useStreamProcessor as
|
|
13
|
-
import { DataSummaryGroup as
|
|
14
|
-
import { useState as
|
|
15
|
-
import { DynamicComponent as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
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
|
|
28
|
-
if (!
|
|
29
|
-
const a =
|
|
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
|
|
33
|
-
if (!
|
|
34
|
-
const a =
|
|
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
|
-
},
|
|
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: `${
|
|
42
|
+
animationDelay: `${e * 0.2}s`
|
|
42
43
|
},
|
|
43
44
|
children: "."
|
|
44
45
|
},
|
|
45
|
-
|
|
46
|
-
)) }),
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
55
|
-
] }),
|
|
56
|
-
tool:
|
|
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:
|
|
59
|
+
renderText: l,
|
|
59
60
|
approvalId: s,
|
|
60
|
-
messagePartsLength:
|
|
61
|
+
messagePartsLength: d,
|
|
61
62
|
setApprovalDelayPending: n,
|
|
62
|
-
addToolApprovalResponse:
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
addToolApprovalResponse: u,
|
|
64
|
+
addToolOutput: p,
|
|
65
|
+
sendMessage: y,
|
|
66
|
+
conversationId: o
|
|
65
67
|
}) => {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
const m =
|
|
69
|
-
m.current =
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
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,
|
|
77
|
-
),
|
|
78
|
-
|
|
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
|
|
81
|
-
return
|
|
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:
|
|
137
|
+
className: k(
|
|
85
138
|
"inline-flex font-mono font-semibold items-center px-1 py-0.5 text-1xs rounded-md border",
|
|
86
|
-
|
|
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:
|
|
141
|
+
children: e ? "true" : "false"
|
|
89
142
|
}
|
|
90
|
-
) : typeof
|
|
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
|
|
93
|
-
name:
|
|
145
|
+
const se = ({
|
|
146
|
+
name: e,
|
|
94
147
|
value: a,
|
|
95
|
-
isArrayIndex:
|
|
148
|
+
isArrayIndex: l,
|
|
96
149
|
depth: s = 0
|
|
97
150
|
}) => {
|
|
98
|
-
const [
|
|
99
|
-
if (!(
|
|
100
|
-
return /* @__PURE__ */
|
|
101
|
-
/* @__PURE__ */
|
|
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:
|
|
157
|
+
className: k(
|
|
105
158
|
"font-medium shrink-0",
|
|
106
|
-
|
|
159
|
+
l ? "text-gray-300 dark:text-white-alpha-300" : "text-gray-500 dark:text-white-alpha-500"
|
|
107
160
|
),
|
|
108
|
-
children:
|
|
161
|
+
children: l ? "—" : e
|
|
109
162
|
}
|
|
110
163
|
),
|
|
111
|
-
/* @__PURE__ */
|
|
164
|
+
/* @__PURE__ */ t("span", { className: "min-w-0", children: ne(a) })
|
|
112
165
|
] });
|
|
113
|
-
const
|
|
114
|
-
return
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
] }) : /* @__PURE__ */
|
|
118
|
-
/* @__PURE__ */
|
|
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: (
|
|
123
|
-
|
|
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__ */
|
|
128
|
-
|
|
180
|
+
/* @__PURE__ */ t(
|
|
181
|
+
te,
|
|
129
182
|
{
|
|
130
|
-
className:
|
|
183
|
+
className: k(
|
|
131
184
|
"h-3.5 w-3.5 text-gray-400 dark:text-white-alpha-400 shrink-0 transition-transform",
|
|
132
|
-
!
|
|
185
|
+
!d && "-rotate-90"
|
|
133
186
|
)
|
|
134
187
|
}
|
|
135
188
|
),
|
|
136
|
-
/* @__PURE__ */
|
|
137
|
-
!
|
|
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
|
-
|
|
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
|
-
},
|
|
144
|
-
if (
|
|
145
|
-
return /* @__PURE__ */
|
|
146
|
-
const a = Array.isArray(
|
|
147
|
-
return a.length === 0 ? /* @__PURE__ */
|
|
148
|
-
},
|
|
149
|
-
const { tool: a, approve:
|
|
150
|
-
return
|
|
151
|
-
|
|
152
|
-
}, [
|
|
153
|
-
/* @__PURE__ */
|
|
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: () =>
|
|
159
|
-
"aria-expanded":
|
|
160
|
-
"data-expanded":
|
|
211
|
+
onClick: () => m(!c),
|
|
212
|
+
"aria-expanded": c,
|
|
213
|
+
"data-expanded": c,
|
|
161
214
|
children: [
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
-
/* @__PURE__ */
|
|
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__ */
|
|
167
|
-
/* @__PURE__ */
|
|
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__ */
|
|
224
|
+
return /* @__PURE__ */ t(_e, { className: "w-3 h-3" });
|
|
172
225
|
case "input-available":
|
|
173
|
-
return /* @__PURE__ */
|
|
226
|
+
return /* @__PURE__ */ t(Ee, { className: "w-3 h-3 animate-spin" });
|
|
174
227
|
case "approval-requested":
|
|
175
|
-
return /* @__PURE__ */
|
|
228
|
+
return /* @__PURE__ */ t(De, { className: "w-3 h-3" });
|
|
176
229
|
case "approval-responded":
|
|
177
|
-
return /* @__PURE__ */
|
|
230
|
+
return /* @__PURE__ */ t(Z, { className: "w-3 h-3" });
|
|
178
231
|
case "output-available":
|
|
179
|
-
return /* @__PURE__ */
|
|
232
|
+
return /* @__PURE__ */ t(Z, { className: "w-3 h-3" });
|
|
180
233
|
case "output-error":
|
|
181
|
-
return /* @__PURE__ */
|
|
234
|
+
return /* @__PURE__ */ t(Se, { className: "w-3 h-3" });
|
|
182
235
|
case "output-denied":
|
|
183
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
248
|
+
/* @__PURE__ */ i(
|
|
196
249
|
"div",
|
|
197
250
|
{
|
|
198
|
-
"data-expanded":
|
|
199
|
-
className:
|
|
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__ */
|
|
256
|
+
/* @__PURE__ */ t(
|
|
204
257
|
"div",
|
|
205
258
|
{
|
|
206
|
-
"data-expanded":
|
|
207
|
-
className:
|
|
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__ */
|
|
268
|
+
children: /* @__PURE__ */ t(
|
|
216
269
|
"div",
|
|
217
270
|
{
|
|
218
|
-
"data-expanded":
|
|
219
|
-
className:
|
|
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__ */
|
|
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
|
-
|
|
229
|
-
/* @__PURE__ */
|
|
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:
|
|
234
|
-
|
|
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: () =>
|
|
290
|
+
onClick: () => l(!1),
|
|
238
291
|
children: "Deny"
|
|
239
292
|
}
|
|
240
293
|
),
|
|
241
|
-
/* @__PURE__ */
|
|
294
|
+
/* @__PURE__ */ i(
|
|
242
295
|
"button",
|
|
243
296
|
{
|
|
244
297
|
type: "button",
|
|
245
|
-
className:
|
|
246
|
-
|
|
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: () =>
|
|
302
|
+
onClick: () => l(!0),
|
|
250
303
|
children: [
|
|
251
|
-
/* @__PURE__ */
|
|
304
|
+
/* @__PURE__ */ t(Q, { className: "w-3 h-3" }),
|
|
252
305
|
"Approve"
|
|
253
306
|
]
|
|
254
307
|
}
|
|
255
308
|
)
|
|
256
309
|
] }),
|
|
257
|
-
n === "output-available" &&
|
|
258
|
-
|
|
259
|
-
|
|
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__ */
|
|
262
|
-
/* @__PURE__ */
|
|
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
|
-
},
|
|
270
|
-
className:
|
|
322
|
+
}, nt = ({
|
|
323
|
+
className: e,
|
|
271
324
|
componentStyles: a,
|
|
272
|
-
children:
|
|
325
|
+
children: l,
|
|
273
326
|
isLast: s,
|
|
274
|
-
...
|
|
327
|
+
...d
|
|
275
328
|
}) => {
|
|
276
|
-
const { message: n } =
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
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
|
|
285
|
-
|
|
345
|
+
return q(!1), b.current && clearTimeout(b.current), b.current = window.setTimeout(() => {
|
|
346
|
+
q(!0);
|
|
286
347
|
}, 1e3), () => {
|
|
287
|
-
|
|
348
|
+
b.current && (clearTimeout(b.current), b.current = null);
|
|
288
349
|
};
|
|
289
|
-
}, [
|
|
290
|
-
|
|
291
|
-
}, [
|
|
292
|
-
const
|
|
293
|
-
() =>
|
|
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
|
-
),
|
|
356
|
+
), J = S(
|
|
296
357
|
(r, x) => {
|
|
297
|
-
|
|
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
|
-
[
|
|
306
|
-
),
|
|
366
|
+
[u]
|
|
367
|
+
), Y = S(
|
|
307
368
|
(r, x) => {
|
|
308
|
-
|
|
369
|
+
u({
|
|
309
370
|
eventName: "assistant_code_block_copied",
|
|
310
371
|
properties: {
|
|
311
|
-
conversationId:
|
|
372
|
+
conversationId: p,
|
|
312
373
|
language: r,
|
|
313
374
|
code: x
|
|
314
375
|
}
|
|
315
376
|
});
|
|
316
377
|
},
|
|
317
|
-
[
|
|
318
|
-
),
|
|
319
|
-
(r) => /* @__PURE__ */
|
|
320
|
-
|
|
378
|
+
[u, p]
|
|
379
|
+
), F = S(
|
|
380
|
+
(r) => /* @__PURE__ */ t(
|
|
381
|
+
fe,
|
|
321
382
|
{
|
|
322
383
|
text: r,
|
|
323
|
-
componentStyles:
|
|
324
|
-
onLinkClick:
|
|
325
|
-
onCodeCopy:
|
|
326
|
-
artifacts:
|
|
384
|
+
componentStyles: H,
|
|
385
|
+
onLinkClick: J,
|
|
386
|
+
onCodeCopy: Y,
|
|
387
|
+
artifacts: G
|
|
327
388
|
}
|
|
328
389
|
),
|
|
329
|
-
[
|
|
330
|
-
),
|
|
331
|
-
() =>
|
|
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
|
-
|
|
394
|
+
e
|
|
334
395
|
),
|
|
335
|
-
[
|
|
336
|
-
),
|
|
396
|
+
[e]
|
|
397
|
+
), de = !z || n.parts.some(
|
|
337
398
|
(r) => r.type === "text" && r.text?.trim()
|
|
338
399
|
);
|
|
339
|
-
return /* @__PURE__ */
|
|
340
|
-
!
|
|
341
|
-
|
|
342
|
-
const
|
|
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
|
-
...
|
|
346
|
-
className:
|
|
406
|
+
...d,
|
|
407
|
+
className: le
|
|
347
408
|
};
|
|
348
409
|
switch (r?.type) {
|
|
349
410
|
case "text":
|
|
350
|
-
return /* @__PURE__ */
|
|
411
|
+
return /* @__PURE__ */ t(j, { ...A, children: z ? r.text : F(r.text || "") }, x);
|
|
351
412
|
case "data-component": {
|
|
352
|
-
const { type:
|
|
353
|
-
switch (
|
|
413
|
+
const { type: N } = r.data;
|
|
414
|
+
switch (N) {
|
|
354
415
|
case "text":
|
|
355
|
-
return /* @__PURE__ */
|
|
416
|
+
return /* @__PURE__ */ t("div", { ...A, children: F(r.data.text || "") }, x);
|
|
356
417
|
default: {
|
|
357
|
-
const
|
|
358
|
-
return /* @__PURE__ */
|
|
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
|
|
364
|
-
if (
|
|
365
|
-
const
|
|
366
|
-
return /* @__PURE__ */
|
|
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
|
|
430
|
+
const N = D.get(r.groupKey) || {
|
|
370
431
|
isCompleted: !1
|
|
371
432
|
};
|
|
372
|
-
return /* @__PURE__ */
|
|
373
|
-
|
|
433
|
+
return /* @__PURE__ */ t(j, { ...A, children: /* @__PURE__ */ t(
|
|
434
|
+
ke,
|
|
374
435
|
{
|
|
375
436
|
summaries: r.summaries || [],
|
|
376
|
-
isCompleted:
|
|
437
|
+
isCompleted: N.isCompleted
|
|
377
438
|
}
|
|
378
439
|
) }, `${r.groupKey}-${x}`);
|
|
379
440
|
}
|
|
380
441
|
default: {
|
|
381
|
-
if (!
|
|
442
|
+
if (!Oe(r))
|
|
382
443
|
return null;
|
|
383
|
-
const
|
|
384
|
-
return
|
|
385
|
-
|
|
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:
|
|
388
|
-
componentDef:
|
|
389
|
-
renderText:
|
|
390
|
-
approvalId:
|
|
448
|
+
tool: N,
|
|
449
|
+
componentDef: O?.IkpTool,
|
|
450
|
+
renderText: F,
|
|
451
|
+
approvalId: T,
|
|
391
452
|
messagePartsLength: n.parts.length,
|
|
392
|
-
setApprovalDelayPending:
|
|
393
|
-
addToolApprovalResponse:
|
|
394
|
-
|
|
395
|
-
|
|
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
|
-
|
|
402
|
-
(
|
|
463
|
+
K && /* @__PURE__ */ t(ve, {}),
|
|
464
|
+
(C || ie) && /* @__PURE__ */ t(Pe, {})
|
|
403
465
|
] });
|
|
404
466
|
};
|
|
405
467
|
export {
|
|
406
|
-
|
|
407
|
-
|
|
468
|
+
ze as DefaultToolComponent,
|
|
469
|
+
nt as EmbeddedChatMessagePart
|
|
408
470
|
};
|