@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.
- package/dist/index.cjs +1 -1
- package/dist/index.js +156 -153
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +2 -2
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.d.ts +0 -13
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +224 -238
- package/dist/primitives/components/embedded-chat.d.ts +1 -1
- package/dist/primitives/index.cjs +1 -1
- package/dist/primitives/index.js +144 -141
- package/dist/primitives/providers/chat-auth-provider.cjs +1 -0
- package/dist/primitives/providers/chat-auth-provider.d.ts +15 -0
- package/dist/primitives/providers/chat-auth-provider.js +44 -0
- package/dist/primitives/providers/index.cjs +1 -1
- package/dist/primitives/providers/index.d.ts +1 -0
- package/dist/primitives/providers/index.js +51 -48
- package/dist/react/embedded-chat.cjs +1 -1
- package/dist/react/embedded-chat.js +75 -74
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +156 -153
- package/dist/styled/components/message.cjs +1 -1
- package/dist/styled/components/message.js +210 -272
- package/dist/styled/index.cjs +1 -1
- package/dist/styled/index.js +148 -145
- package/dist/styled/inkeep.css.cjs +0 -78
- package/dist/styled/inkeep.css.js +0 -78
- package/package.json +1 -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.cjs +0 -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.js +0 -93
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.cjs +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/core.js +0 -49
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.cjs +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/errors.js +0 -19
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.cjs +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/parse.js +0 -28
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.cjs +0 -1
- package/dist/node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/util.js +0 -23
- package/dist/styled/components/ask-user-form.cjs +0 -1
- package/dist/styled/components/ask-user-form.d.ts +0 -96
- package/dist/styled/components/ask-user-form.js +0 -672
|
@@ -1,22 +1,21 @@
|
|
|
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
|
-
|
|
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
|
|
29
|
-
if (!
|
|
30
|
-
const a =
|
|
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
|
|
34
|
-
if (!
|
|
35
|
-
const a =
|
|
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
|
-
},
|
|
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: `${
|
|
41
|
+
animationDelay: `${t * 0.2}s`
|
|
43
42
|
},
|
|
44
43
|
children: "."
|
|
45
44
|
},
|
|
46
|
-
|
|
47
|
-
)) }),
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
56
|
-
] }),
|
|
57
|
-
tool:
|
|
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:
|
|
58
|
+
renderText: i,
|
|
60
59
|
approvalId: s,
|
|
61
|
-
messagePartsLength:
|
|
60
|
+
messagePartsLength: u,
|
|
62
61
|
setApprovalDelayPending: n,
|
|
63
|
-
addToolApprovalResponse:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
conversationId: o
|
|
62
|
+
addToolApprovalResponse: c,
|
|
63
|
+
sendMessage: d,
|
|
64
|
+
conversationId: f
|
|
67
65
|
}) => {
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
const m =
|
|
71
|
-
m.current =
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
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,
|
|
81
|
-
),
|
|
82
|
-
|
|
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
|
|
134
|
-
return
|
|
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:
|
|
84
|
+
className: y(
|
|
138
85
|
"inline-flex font-mono font-semibold items-center px-1 py-0.5 text-1xs rounded-md border",
|
|
139
|
-
|
|
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:
|
|
88
|
+
children: t ? "true" : "false"
|
|
142
89
|
}
|
|
143
|
-
) : typeof
|
|
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
|
|
146
|
-
name:
|
|
92
|
+
const Q = ({
|
|
93
|
+
name: t,
|
|
147
94
|
value: a,
|
|
148
|
-
isArrayIndex:
|
|
95
|
+
isArrayIndex: i,
|
|
149
96
|
depth: s = 0
|
|
150
97
|
}) => {
|
|
151
|
-
const [
|
|
152
|
-
if (!(
|
|
153
|
-
return /* @__PURE__ */
|
|
154
|
-
/* @__PURE__ */
|
|
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:
|
|
104
|
+
className: y(
|
|
158
105
|
"font-medium shrink-0",
|
|
159
|
-
|
|
106
|
+
i ? "text-gray-300 dark:text-white-alpha-300" : "text-gray-500 dark:text-white-alpha-500"
|
|
160
107
|
),
|
|
161
|
-
children:
|
|
108
|
+
children: i ? "—" : t
|
|
162
109
|
}
|
|
163
110
|
),
|
|
164
|
-
/* @__PURE__ */
|
|
111
|
+
/* @__PURE__ */ e("span", { className: "min-w-0", children: J(a) })
|
|
165
112
|
] });
|
|
166
|
-
const
|
|
167
|
-
return
|
|
168
|
-
/* @__PURE__ */
|
|
169
|
-
/* @__PURE__ */
|
|
170
|
-
] }) : /* @__PURE__ */
|
|
171
|
-
/* @__PURE__ */
|
|
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: (
|
|
176
|
-
|
|
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__ */
|
|
181
|
-
|
|
127
|
+
/* @__PURE__ */ e(
|
|
128
|
+
G,
|
|
182
129
|
{
|
|
183
|
-
className:
|
|
130
|
+
className: y(
|
|
184
131
|
"h-3.5 w-3.5 text-gray-400 dark:text-white-alpha-400 shrink-0 transition-transform",
|
|
185
|
-
!
|
|
132
|
+
!u && "-rotate-90"
|
|
186
133
|
)
|
|
187
134
|
}
|
|
188
135
|
),
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
!
|
|
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
|
-
|
|
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
|
-
},
|
|
197
|
-
if (
|
|
198
|
-
return /* @__PURE__ */
|
|
199
|
-
const a = Array.isArray(
|
|
200
|
-
return a.length === 0 ? /* @__PURE__ */
|
|
201
|
-
},
|
|
202
|
-
const { tool: a, approve:
|
|
203
|
-
return
|
|
204
|
-
|
|
205
|
-
}, [
|
|
206
|
-
/* @__PURE__ */
|
|
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: () =>
|
|
212
|
-
"aria-expanded":
|
|
213
|
-
"data-expanded":
|
|
158
|
+
onClick: () => p(!m),
|
|
159
|
+
"aria-expanded": m,
|
|
160
|
+
"data-expanded": m,
|
|
214
161
|
children: [
|
|
215
|
-
/* @__PURE__ */
|
|
216
|
-
/* @__PURE__ */
|
|
217
|
-
/* @__PURE__ */
|
|
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__ */
|
|
220
|
-
/* @__PURE__ */
|
|
166
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
|
|
167
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-1.5 px-1.5 py-0.5 rounded-md text-2xs uppercase tracking-wider bg-gray-100 dark:bg-white-alpha-100 font-medium text-gray-700 dark:text-white-alpha-700 font-mono", children: [
|
|
221
168
|
(() => {
|
|
222
169
|
switch (n) {
|
|
223
170
|
case "input-streaming":
|
|
224
|
-
return /* @__PURE__ */
|
|
171
|
+
return /* @__PURE__ */ e(Se, { className: "w-3 h-3" });
|
|
225
172
|
case "input-available":
|
|
226
|
-
return /* @__PURE__ */
|
|
173
|
+
return /* @__PURE__ */ e(De, { className: "w-3 h-3 animate-spin" });
|
|
227
174
|
case "approval-requested":
|
|
228
|
-
return /* @__PURE__ */
|
|
175
|
+
return /* @__PURE__ */ e(Ce, { className: "w-3 h-3" });
|
|
229
176
|
case "approval-responded":
|
|
230
|
-
return /* @__PURE__ */
|
|
177
|
+
return /* @__PURE__ */ e(W, { className: "w-3 h-3" });
|
|
231
178
|
case "output-available":
|
|
232
|
-
return /* @__PURE__ */
|
|
179
|
+
return /* @__PURE__ */ e(W, { className: "w-3 h-3" });
|
|
233
180
|
case "output-error":
|
|
234
|
-
return /* @__PURE__ */
|
|
181
|
+
return /* @__PURE__ */ e(ve, { className: "w-3 h-3" });
|
|
235
182
|
case "output-denied":
|
|
236
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
195
|
+
/* @__PURE__ */ o(
|
|
249
196
|
"div",
|
|
250
197
|
{
|
|
251
|
-
"data-expanded":
|
|
252
|
-
className:
|
|
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__ */
|
|
203
|
+
/* @__PURE__ */ e(
|
|
257
204
|
"div",
|
|
258
205
|
{
|
|
259
|
-
"data-expanded":
|
|
260
|
-
className:
|
|
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__ */
|
|
215
|
+
children: /* @__PURE__ */ e(
|
|
269
216
|
"div",
|
|
270
217
|
{
|
|
271
|
-
"data-expanded":
|
|
272
|
-
className:
|
|
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__ */
|
|
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
|
-
|
|
282
|
-
/* @__PURE__ */
|
|
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:
|
|
287
|
-
|
|
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: () =>
|
|
237
|
+
onClick: () => i(!1),
|
|
291
238
|
children: "Deny"
|
|
292
239
|
}
|
|
293
240
|
),
|
|
294
|
-
/* @__PURE__ */
|
|
241
|
+
/* @__PURE__ */ o(
|
|
295
242
|
"button",
|
|
296
243
|
{
|
|
297
244
|
type: "button",
|
|
298
|
-
className:
|
|
299
|
-
|
|
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: () =>
|
|
249
|
+
onClick: () => i(!0),
|
|
303
250
|
children: [
|
|
304
|
-
/* @__PURE__ */
|
|
251
|
+
/* @__PURE__ */ e(K, { className: "w-3 h-3" }),
|
|
305
252
|
"Approve"
|
|
306
253
|
]
|
|
307
254
|
}
|
|
308
255
|
)
|
|
309
256
|
] }),
|
|
310
|
-
n === "output-available" &&
|
|
311
|
-
|
|
312
|
-
|
|
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__ */
|
|
315
|
-
/* @__PURE__ */
|
|
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
|
-
},
|
|
323
|
-
className:
|
|
269
|
+
}, Ze = ({
|
|
270
|
+
className: t,
|
|
324
271
|
componentStyles: a,
|
|
325
|
-
children:
|
|
272
|
+
children: i,
|
|
326
273
|
isLast: s,
|
|
327
|
-
...
|
|
274
|
+
...u
|
|
328
275
|
}) => {
|
|
329
|
-
const { message: n } =
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
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
|
|
346
|
-
|
|
284
|
+
return _(!1), g.current && clearTimeout(g.current), g.current = window.setTimeout(() => {
|
|
285
|
+
_(!0);
|
|
347
286
|
}, 1e3), () => {
|
|
348
|
-
|
|
287
|
+
g.current && (clearTimeout(g.current), g.current = null);
|
|
349
288
|
};
|
|
350
|
-
}, [
|
|
351
|
-
|
|
352
|
-
}, [
|
|
353
|
-
const
|
|
354
|
-
() =>
|
|
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
|
-
),
|
|
295
|
+
), B = P(
|
|
357
296
|
(r, x) => {
|
|
358
|
-
|
|
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
|
-
[
|
|
367
|
-
),
|
|
305
|
+
[c]
|
|
306
|
+
), F = P(
|
|
368
307
|
(r, x) => {
|
|
369
|
-
|
|
308
|
+
c({
|
|
370
309
|
eventName: "assistant_code_block_copied",
|
|
371
310
|
properties: {
|
|
372
|
-
conversationId:
|
|
311
|
+
conversationId: d,
|
|
373
312
|
language: r,
|
|
374
313
|
code: x
|
|
375
314
|
}
|
|
376
315
|
});
|
|
377
316
|
},
|
|
378
|
-
[
|
|
379
|
-
),
|
|
380
|
-
(r) => /* @__PURE__ */
|
|
381
|
-
|
|
317
|
+
[c, d]
|
|
318
|
+
), $ = P(
|
|
319
|
+
(r) => /* @__PURE__ */ e(
|
|
320
|
+
me,
|
|
382
321
|
{
|
|
383
322
|
text: r,
|
|
384
|
-
componentStyles:
|
|
385
|
-
onLinkClick:
|
|
386
|
-
onCodeCopy:
|
|
387
|
-
artifacts:
|
|
323
|
+
componentStyles: V,
|
|
324
|
+
onLinkClick: B,
|
|
325
|
+
onCodeCopy: F,
|
|
326
|
+
artifacts: U
|
|
388
327
|
}
|
|
389
328
|
),
|
|
390
|
-
[
|
|
391
|
-
),
|
|
392
|
-
() =>
|
|
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
|
-
|
|
333
|
+
t
|
|
395
334
|
),
|
|
396
|
-
[
|
|
397
|
-
),
|
|
335
|
+
[t]
|
|
336
|
+
), oe = !z || n.parts.some(
|
|
398
337
|
(r) => r.type === "text" && r.text?.trim()
|
|
399
338
|
);
|
|
400
|
-
return /* @__PURE__ */
|
|
401
|
-
!
|
|
402
|
-
|
|
403
|
-
const
|
|
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
|
-
...
|
|
407
|
-
className:
|
|
345
|
+
...u,
|
|
346
|
+
className: se
|
|
408
347
|
};
|
|
409
348
|
switch (r?.type) {
|
|
410
349
|
case "text":
|
|
411
|
-
return /* @__PURE__ */
|
|
350
|
+
return /* @__PURE__ */ e(S, { ...k, children: z ? r.text : $(r.text || "") }, x);
|
|
412
351
|
case "data-component": {
|
|
413
|
-
const { type:
|
|
414
|
-
switch (
|
|
352
|
+
const { type: w } = r.data;
|
|
353
|
+
switch (w) {
|
|
415
354
|
case "text":
|
|
416
|
-
return /* @__PURE__ */
|
|
355
|
+
return /* @__PURE__ */ e("div", { ...k, children: $(r.data.text || "") }, x);
|
|
417
356
|
default: {
|
|
418
|
-
const
|
|
419
|
-
return /* @__PURE__ */
|
|
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
|
|
425
|
-
if (
|
|
426
|
-
const
|
|
427
|
-
return /* @__PURE__ */
|
|
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
|
|
369
|
+
const w = te.get(r.groupKey) || {
|
|
431
370
|
isCompleted: !1
|
|
432
371
|
};
|
|
433
|
-
return /* @__PURE__ */
|
|
434
|
-
|
|
372
|
+
return /* @__PURE__ */ e(S, { ...k, children: /* @__PURE__ */ e(
|
|
373
|
+
ye,
|
|
435
374
|
{
|
|
436
375
|
summaries: r.summaries || [],
|
|
437
|
-
isCompleted:
|
|
376
|
+
isCompleted: w.isCompleted
|
|
438
377
|
}
|
|
439
378
|
) }, `${r.groupKey}-${x}`);
|
|
440
379
|
}
|
|
441
380
|
default: {
|
|
442
|
-
if (!
|
|
381
|
+
if (!Pe(r))
|
|
443
382
|
return null;
|
|
444
|
-
const
|
|
445
|
-
return
|
|
446
|
-
|
|
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:
|
|
449
|
-
componentDef:
|
|
450
|
-
renderText:
|
|
451
|
-
approvalId:
|
|
387
|
+
tool: w,
|
|
388
|
+
componentDef: v?.IkpTool,
|
|
389
|
+
renderText: $,
|
|
390
|
+
approvalId: N,
|
|
452
391
|
messagePartsLength: n.parts.length,
|
|
453
|
-
setApprovalDelayPending:
|
|
454
|
-
addToolApprovalResponse:
|
|
455
|
-
|
|
456
|
-
|
|
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
|
-
|
|
464
|
-
(
|
|
401
|
+
ae && /* @__PURE__ */ e(be, {}),
|
|
402
|
+
(re || ne) && /* @__PURE__ */ e(Le, {})
|
|
465
403
|
] });
|
|
466
404
|
};
|
|
467
405
|
export {
|
|
468
|
-
|
|
469
|
-
|
|
406
|
+
Me as DefaultToolComponent,
|
|
407
|
+
Ze as EmbeddedChatMessagePart
|
|
470
408
|
};
|