@object-ui/plugin-chatbot 17.3.0 → 17.6.0
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/CHANGELOG.md +368 -0
- package/README.md +81 -12
- package/dist/ChatbotEnhanced.d.ts +29 -0
- package/dist/ChatbotEnhanced.d.ts.map +1 -1
- package/dist/chatMessageAdapter.d.ts +134 -0
- package/dist/chatMessageAdapter.d.ts.map +1 -0
- package/dist/elements/prompt-input.d.ts.map +1 -1
- package/dist/index.d.ts +55 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1252 -1055
- package/dist/index.umd.cjs +3 -1
- package/dist/mapMessages.d.ts +53 -0
- package/dist/mapMessages.d.ts.map +1 -1
- package/dist/tool-display.d.ts +30 -1
- package/dist/tool-display.d.ts.map +1 -1
- package/dist/useHitlInChat.d.ts +19 -1
- package/dist/useHitlInChat.d.ts.map +1 -1
- package/dist/useObjectChat.d.ts +65 -5
- package/dist/useObjectChat.d.ts.map +1 -1
- package/dist/usePendingActions.d.ts +39 -17
- package/dist/usePendingActions.d.ts.map +1 -1
- package/package.json +14 -14
package/dist/index.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
2
|
import { Children as t, Fragment as n, createContext as r, isValidElement as i, memo as a, useCallback as o, useContext as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
3
|
-
import { Alert as f, AlertDescription as p, Avatar as m, AvatarFallback as h, AvatarImage as g, Badge as _, Button as v, Card as y, CardContent as b, CardDescription as x, CardHeader as S, CardTitle as C, Collapsible as w, CollapsibleContent as T, CollapsibleTrigger as E, Command as D, CommandEmpty as O, CommandGroup as k, CommandInput as A, CommandItem as j, CommandList as M, CommandSeparator as N, DropdownMenu as ee, DropdownMenuContent as P, DropdownMenuItem as F, DropdownMenuTrigger as I, Empty as te, EmptyDescription as ne, EmptyHeader as L, EmptyMedia as re, EmptyTitle as ie, HoverCard as R, HoverCardContent as ae, HoverCardTrigger as oe, Input as z, Label as B, ScrollArea as
|
|
4
|
-
import { AlertCircle as
|
|
3
|
+
import { Alert as f, AlertDescription as p, Avatar as m, AvatarFallback as h, AvatarImage as g, Badge as _, Button as v, Card as y, CardContent as b, CardDescription as x, CardHeader as S, CardTitle as C, Collapsible as w, CollapsibleContent as T, CollapsibleTrigger as E, Command as D, CommandEmpty as O, CommandGroup as k, CommandInput as A, CommandItem as j, CommandList as M, CommandSeparator as N, DropdownMenu as ee, DropdownMenuContent as P, DropdownMenuItem as F, DropdownMenuTrigger as I, Empty as te, EmptyDescription as ne, EmptyHeader as L, EmptyMedia as re, EmptyTitle as ie, HoverCard as R, HoverCardContent as ae, HoverCardTrigger as oe, Input as z, Label as B, ScrollArea as se, ScrollBar as V, Select as ce, SelectContent as le, SelectItem as ue, SelectTrigger as de, SelectValue as fe, Separator as pe, Sheet as me, SheetContent as he, SheetDescription as ge, SheetHeader as _e, SheetTitle as ve, Skeleton as ye, Table as be, TableBody as xe, TableCell as H, TableHead as U, TableHeader as Se, TableRow as Ce, Tabs as we, TabsList as Te, TabsTrigger as Ee, Textarea as De, Tooltip as Oe, TooltipContent as ke, TooltipProvider as Ae, TooltipTrigger as je, cn as W } from "@object-ui/components";
|
|
4
|
+
import { AlertCircle as Me, ArrowDownIcon as Ne, ArrowRight as Pe, BookIcon as Fe, Bot as Ie, BrainIcon as Le, Check as Re, CheckCircle2 as G, CheckCircleIcon as ze, CheckIcon as Be, ChevronDownIcon as Ve, ChevronLeftIcon as He, ChevronRightIcon as Ue, CircleIcon as K, ClipboardList as We, Clock as Ge, Clock3 as Ke, ClockIcon as qe, Copy as Je, CopyIcon as Ye, CornerDownLeft as Xe, CornerDownLeftIcon as Ze, Eye as Qe, GitCompareArrows as $e, HelpCircle as et, Hourglass as tt, ImageIcon as nt, Inbox as rt, Loader2 as it, Loader2Icon as at, Maximize2 as ot, MicIcon as st, Minimize2 as q, PaperclipIcon as ct, PlusIcon as lt, RefreshCw as ut, Rocket as dt, Send as ft, ShieldCheck as pt, Sparkles as mt, SquareIcon as ht, Table2 as gt, TriangleAlert as _t, WifiOff as vt, WrenchIcon as yt, X as bt, XCircle as J, XCircleIcon as xt, XIcon as Y } from "lucide-react";
|
|
5
5
|
import { Fragment as X, jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
6
6
|
import { useChat as St } from "@ai-sdk/react";
|
|
7
7
|
import { DefaultChatTransport as Ct } from "ai";
|
|
8
8
|
import * as wt from "react-dom";
|
|
9
|
-
import { SchemaRenderer as Tt, useObjectTranslation as
|
|
10
|
-
import { useObjectTranslation as
|
|
11
|
-
import { StickToBottom as
|
|
12
|
-
import { cva as
|
|
13
|
-
import { Slot as
|
|
14
|
-
import { Streamdown as
|
|
15
|
-
import { nanoid as
|
|
16
|
-
import { codeToHtml as
|
|
17
|
-
import { useControllableState as
|
|
18
|
-
import { motion as
|
|
19
|
-
import { ComponentRegistry as
|
|
9
|
+
import { SchemaRenderer as Tt, useObjectTranslation as Et } from "@object-ui/react";
|
|
10
|
+
import { useObjectTranslation as Dt, useSafeTranslate as Ot } from "@object-ui/i18n";
|
|
11
|
+
import { StickToBottom as kt, useStickToBottomContext as At } from "use-stick-to-bottom";
|
|
12
|
+
import { cva as jt } from "class-variance-authority";
|
|
13
|
+
import { Slot as Mt } from "@radix-ui/react-slot";
|
|
14
|
+
import { Streamdown as Nt } from "streamdown";
|
|
15
|
+
import { nanoid as Pt } from "nanoid";
|
|
16
|
+
import { codeToHtml as Ft } from "shiki";
|
|
17
|
+
import { useControllableState as It } from "@radix-ui/react-use-controllable-state";
|
|
18
|
+
import { motion as Lt } from "motion/react";
|
|
19
|
+
import { ComponentRegistry as Rt, toDomProps as zt } from "@object-ui/core";
|
|
20
20
|
//#region \0rolldown/runtime.js
|
|
21
|
-
var
|
|
21
|
+
var Bt = Object.defineProperty, Vt = (e, t) => {
|
|
22
22
|
let n = {};
|
|
23
|
-
for (var r in e)
|
|
23
|
+
for (var r in e) Bt(n, r, {
|
|
24
24
|
get: e[r],
|
|
25
25
|
enumerable: !0
|
|
26
26
|
});
|
|
27
|
-
return t ||
|
|
27
|
+
return t || Bt(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
28
28
|
};
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region src/utils.ts
|
|
31
|
-
function
|
|
31
|
+
function Ht(e = "msg") {
|
|
32
32
|
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${e}-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
33
33
|
}
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region src/mapMessages.ts
|
|
36
|
-
function
|
|
36
|
+
function Ut(e, t) {
|
|
37
37
|
return typeof e.content == "string" ? e.content : t.filter((e) => e.type === "text").map((e) => e.text ?? "").join("");
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function Wt(e) {
|
|
40
40
|
let t = e.filter((e) => e.type === "reasoning" || e.type === "reasoning-delta").map((e) => e.text ?? "").join("\n").trim();
|
|
41
41
|
return t.length > 0 ? t : void 0;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function $(e) {
|
|
44
44
|
let t = (e) => {
|
|
45
45
|
if (e && typeof e == "object") return e;
|
|
46
46
|
if (typeof e != "string") return;
|
|
@@ -53,18 +53,18 @@ function Ut(e) {
|
|
|
53
53
|
}
|
|
54
54
|
}, n = [e];
|
|
55
55
|
e && typeof e == "object" && "value" in e && n.push(e.value);
|
|
56
|
-
let r;
|
|
56
|
+
let r, i;
|
|
57
57
|
for (let e of n) {
|
|
58
58
|
let n = t(e);
|
|
59
59
|
if (n) {
|
|
60
60
|
if (typeof n.status == "string") return n;
|
|
61
|
-
r ??= n;
|
|
61
|
+
n.type === "text" && "value" in n ? i ??= n : r ??= n;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
return r;
|
|
64
|
+
return r ?? i;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
let t =
|
|
66
|
+
function Gt(e) {
|
|
67
|
+
let t = $(e);
|
|
68
68
|
if (!t) return;
|
|
69
69
|
let n = t.pendingActionId;
|
|
70
70
|
if (t.status === "pending_approval" && typeof n == "string" && n.length > 0) return {
|
|
@@ -72,11 +72,11 @@ function Wt(e) {
|
|
|
72
72
|
raw: t
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function Kt(e) {
|
|
76
76
|
return Array.isArray(e) ? e.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
let t =
|
|
78
|
+
function qt(e) {
|
|
79
|
+
let t = $(e);
|
|
80
80
|
if (!t || t.status !== "blueprint_proposed") return;
|
|
81
81
|
let n = t.blueprint, r = n && typeof n == "object" ? n : {}, i = (Array.isArray(r.objects) ? r.objects : []).flatMap((e) => {
|
|
82
82
|
let t = e;
|
|
@@ -92,7 +92,7 @@ function Kt(e) {
|
|
|
92
92
|
views: a(o.views, Array.isArray(r.views) ? r.views.length : 0),
|
|
93
93
|
dashboards: a(o.dashboards, Array.isArray(r.dashboards) ? r.dashboards.length : 0),
|
|
94
94
|
seedData: a(o.seedData, Array.isArray(r.seedData) ? r.seedData.length : 0)
|
|
95
|
-
}, c =
|
|
95
|
+
}, c = Kt(t.questions), l = t.questionChoices, u = Array.isArray(l) ? l.flatMap((e) => {
|
|
96
96
|
let t = e;
|
|
97
97
|
if (typeof t?.text != "string" || !t.text) return [];
|
|
98
98
|
let n = Array.isArray(t.options) ? t.options.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
|
|
@@ -105,14 +105,14 @@ function Kt(e) {
|
|
|
105
105
|
...d ? { summary: d } : {},
|
|
106
106
|
objects: i,
|
|
107
107
|
counts: s,
|
|
108
|
-
questions: c.length ? c :
|
|
108
|
+
questions: c.length ? c : Kt(r.questions),
|
|
109
109
|
...u.length ? { questionChoices: u } : {},
|
|
110
|
-
assumptions:
|
|
110
|
+
assumptions: Kt(r.assumptions),
|
|
111
111
|
...typeof f == "string" && f ? { targetApp: f } : {}
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
-
function
|
|
115
|
-
let t =
|
|
114
|
+
function Jt(e) {
|
|
115
|
+
let t = $(e);
|
|
116
116
|
if (!t || t.status !== "build_handoff") return;
|
|
117
117
|
let n = typeof t.prompt == "string" ? t.prompt.trim() : "";
|
|
118
118
|
if (!n) return;
|
|
@@ -122,8 +122,8 @@ function qt(e) {
|
|
|
122
122
|
...i ? { packageId: i } : {}
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
-
function
|
|
126
|
-
let t =
|
|
125
|
+
function Yt(e) {
|
|
126
|
+
let t = $(e);
|
|
127
127
|
if (!t || t.status !== "changes_proposed") return;
|
|
128
128
|
let n = (e) => typeof e == "string" && e ? e : void 0, r = t.changes, i = (Array.isArray(r) ? r : []).flatMap((e) => {
|
|
129
129
|
let t = e;
|
|
@@ -141,8 +141,57 @@ function Jt(e) {
|
|
|
141
141
|
changes: i
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
|
|
144
|
+
function Xt(e, t) {
|
|
145
|
+
if (!e || !e.startsWith("replay_")) return;
|
|
146
|
+
let n = $(t);
|
|
147
|
+
if (!n) return;
|
|
148
|
+
if (n.status === "published") return { kind: "published" };
|
|
149
|
+
let r = n.error;
|
|
150
|
+
if (typeof r == "string" && r.trim() && n.status === void 0) return {
|
|
151
|
+
kind: "failed",
|
|
152
|
+
dispatchError: !0,
|
|
153
|
+
error: r.trim().split("\n")[0]
|
|
154
|
+
};
|
|
155
|
+
if (n.status !== "drafted") return;
|
|
156
|
+
let i = n.packageId, a = typeof i == "string" && i ? { packageId: i } : {};
|
|
157
|
+
if (n.publishFailed === !0) {
|
|
158
|
+
let e = n.publishError, t = typeof e == "string" && e.trim() ? e.trim().split("\n")[0] : void 0, r = n.publishOutcome;
|
|
159
|
+
return {
|
|
160
|
+
kind: "failed",
|
|
161
|
+
...typeof r == "string" && r ? { outcome: r } : {},
|
|
162
|
+
...t ? { error: t } : {},
|
|
163
|
+
...a
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
kind: "drafted",
|
|
168
|
+
...a
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function Zt(e) {
|
|
172
|
+
let t = $(e);
|
|
173
|
+
if (!t) return;
|
|
174
|
+
if (t.status === "published") return { kind: "published" };
|
|
175
|
+
if (t.status !== "drafted") return;
|
|
176
|
+
let n = t.packageId, r = typeof n == "string" && n ? { packageId: n } : {};
|
|
177
|
+
return t.publishFailed === !0 ? {
|
|
178
|
+
kind: "failed",
|
|
179
|
+
...r
|
|
180
|
+
} : {
|
|
181
|
+
kind: "drafted",
|
|
182
|
+
...r
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function Qt(e) {
|
|
186
|
+
let t = $(e);
|
|
187
|
+
if (!t || t.status !== "drafted" && t.status !== "published") return;
|
|
188
|
+
let n = t.packageId;
|
|
189
|
+
if (typeof n != "string" || !n) return;
|
|
190
|
+
let r = t.drafted;
|
|
191
|
+
return Array.isArray(r) && r.some((e) => e && typeof e == "object" && e.type === "app") ? n : void 0;
|
|
192
|
+
}
|
|
193
|
+
function $t(e) {
|
|
194
|
+
let t = $(e);
|
|
146
195
|
if (!t || t.status !== "drafted") return;
|
|
147
196
|
let n = [];
|
|
148
197
|
if (Array.isArray(t.drafted)) {
|
|
@@ -182,39 +231,40 @@ function Yt(e) {
|
|
|
182
231
|
...s.length ? { issues: s } : {}
|
|
183
232
|
};
|
|
184
233
|
}
|
|
185
|
-
function
|
|
234
|
+
function en(e) {
|
|
186
235
|
return e.replace(/[._-]+/g, " ").replace(/\s+/g, " ").trim().replace(/\b\w/g, (e) => e.toUpperCase());
|
|
187
236
|
}
|
|
188
|
-
function
|
|
237
|
+
function tn(e) {
|
|
189
238
|
if (!e || !Array.isArray(e.items) || e.items.length === 0) return;
|
|
190
239
|
let t = e.items.find((e) => e.type === "app");
|
|
191
240
|
if (t) return {
|
|
192
241
|
phase: "done",
|
|
193
|
-
appLabel:
|
|
242
|
+
appLabel: en(t.name),
|
|
194
243
|
items: e.items,
|
|
195
244
|
done: e.items.length,
|
|
196
245
|
total: e.items.length
|
|
197
246
|
};
|
|
198
247
|
}
|
|
199
|
-
function
|
|
248
|
+
function nn(e, t = {}) {
|
|
200
249
|
return e.filter((e) => e.type === "dynamic-tool" || typeof e.type == "string" && e.type.startsWith("tool-")).map((e) => {
|
|
201
|
-
let n = e.type === "dynamic-tool" ? e.toolName ?? "tool" : typeof e.type == "string" ? e.type.replace(/^tool-/, "") : "tool", r = e.
|
|
250
|
+
let n = e.type === "dynamic-tool" ? e.toolName ?? "tool" : typeof e.type == "string" ? e.type.replace(/^tool-/, "") : "tool", r = e.toolCallId ?? e.id ?? `${e.type ?? "tool"}-${Math.random().toString(36).slice(2, 8)}`, i = e.output ?? e.result, a = Gt(i), o = Xt(r, i), s = o ? void 0 : $t(i), c = qt(i), l = Yt(i), u = Jt(i), d = e.state, f = (d === "input-available" || d === "input-streaming") && (i !== void 0 || !t.liveTail) ? "output-available" : d, p = a && f !== "output-error" ? "approval-requested" : f;
|
|
202
251
|
return {
|
|
203
|
-
toolCallId:
|
|
252
|
+
toolCallId: r,
|
|
204
253
|
toolName: n,
|
|
205
254
|
args: e.input ?? e.args,
|
|
206
|
-
result:
|
|
255
|
+
result: i,
|
|
207
256
|
errorText: e.errorText,
|
|
208
|
-
state:
|
|
209
|
-
pendingActionId:
|
|
210
|
-
draftReview:
|
|
211
|
-
proposedPlan:
|
|
212
|
-
proposedChanges:
|
|
213
|
-
builderHandoff:
|
|
257
|
+
state: p,
|
|
258
|
+
pendingActionId: a?.pendingActionId,
|
|
259
|
+
draftReview: s,
|
|
260
|
+
proposedPlan: c,
|
|
261
|
+
proposedChanges: l,
|
|
262
|
+
builderHandoff: u,
|
|
263
|
+
replayOutcome: o
|
|
214
264
|
};
|
|
215
265
|
});
|
|
216
266
|
}
|
|
217
|
-
function
|
|
267
|
+
function rn(e) {
|
|
218
268
|
let t = e.filter((e) => e.type === "source-url" || e.type === "source").map((e) => ({
|
|
219
269
|
id: e.id,
|
|
220
270
|
title: e.title,
|
|
@@ -222,7 +272,7 @@ function $t(e) {
|
|
|
222
272
|
})).filter((e) => !!e.url);
|
|
223
273
|
return t.length > 0 ? t : void 0;
|
|
224
274
|
}
|
|
225
|
-
function
|
|
275
|
+
function an(e) {
|
|
226
276
|
let t = e.filter((e) => e.type === "data-build-progress").pop()?.data;
|
|
227
277
|
if (!t || typeof t != "object") return;
|
|
228
278
|
let n = t, r = Array.isArray(n.items) ? n.items.filter((e) => typeof e?.type == "string" && typeof e?.name == "string").map((e) => ({
|
|
@@ -238,7 +288,7 @@ function en(e) {
|
|
|
238
288
|
...typeof n.seq == "number" ? { seq: n.seq } : {}
|
|
239
289
|
};
|
|
240
290
|
}
|
|
241
|
-
function
|
|
291
|
+
function on(e) {
|
|
242
292
|
let t = e.filter((e) => e.type === "data-blueprint-progress").pop()?.data;
|
|
243
293
|
if (!t || typeof t != "object") return;
|
|
244
294
|
let n = t, r = Array.isArray(n.objects) ? n.objects.filter((e) => typeof e?.name == "string").map((e) => ({
|
|
@@ -260,7 +310,7 @@ function tn(e) {
|
|
|
260
310
|
...typeof n.seq == "number" ? { seq: n.seq } : {}
|
|
261
311
|
};
|
|
262
312
|
}
|
|
263
|
-
function
|
|
313
|
+
function sn(e) {
|
|
264
314
|
let t = [];
|
|
265
315
|
for (let n of e) {
|
|
266
316
|
if (n.type !== "data-chart") continue;
|
|
@@ -280,35 +330,70 @@ function nn(e) {
|
|
|
280
330
|
}
|
|
281
331
|
return t.length > 0 ? t : void 0;
|
|
282
332
|
}
|
|
283
|
-
function
|
|
284
|
-
let n = Array.isArray(e.parts) ? e.parts : [], r =
|
|
333
|
+
function cn(e, t = {}) {
|
|
334
|
+
let n = Array.isArray(e.parts) ? e.parts : [], r = nn(n, { liveTail: t.streaming }), i = Array.isArray(e.toolInvocations) ? e.toolInvocations : [], a = r.length > 0 ? r : i, o = an(n) ?? a.map((e) => tn(e.draftReview)).find((e) => !!e);
|
|
285
335
|
return {
|
|
286
336
|
id: e.id ?? `msg-${Math.random().toString(36).slice(2, 8)}`,
|
|
287
337
|
role: e.role ?? "assistant",
|
|
288
|
-
content:
|
|
289
|
-
reasoning:
|
|
338
|
+
content: Ut(e, n),
|
|
339
|
+
reasoning: Wt(n),
|
|
290
340
|
toolInvocations: a,
|
|
291
|
-
sources:
|
|
341
|
+
sources: rn(n),
|
|
292
342
|
buildProgress: o,
|
|
293
|
-
blueprintProgress:
|
|
294
|
-
charts:
|
|
343
|
+
blueprintProgress: on(n),
|
|
344
|
+
charts: sn(n),
|
|
295
345
|
streaming: t.streaming
|
|
296
346
|
};
|
|
297
347
|
}
|
|
298
|
-
function
|
|
348
|
+
function ln(e, t = {}) {
|
|
299
349
|
if (!Array.isArray(e) || e.length === 0) return [];
|
|
300
350
|
let n = e.length - 1;
|
|
301
|
-
return e.map((e, r) =>
|
|
351
|
+
return e.map((e, r) => cn(e, { streaming: !!t.isStreaming && r === n && e.role === "assistant" }));
|
|
352
|
+
}
|
|
353
|
+
//#endregion
|
|
354
|
+
//#region src/chatMessageAdapter.ts
|
|
355
|
+
function un(e) {
|
|
356
|
+
return typeof e == "string" ? e : e instanceof Date ? e.toISOString() : void 0;
|
|
357
|
+
}
|
|
358
|
+
function dn(e) {
|
|
359
|
+
return e === "tool" ? "assistant" : e;
|
|
360
|
+
}
|
|
361
|
+
function fn(e) {
|
|
362
|
+
switch (e) {
|
|
363
|
+
case "partial-call": return "input-streaming";
|
|
364
|
+
case "call": return "input-available";
|
|
365
|
+
case "result": return "output-available";
|
|
366
|
+
default: return e;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
function pn(e) {
|
|
370
|
+
let { state: t, ...n } = e;
|
|
371
|
+
return {
|
|
372
|
+
...n,
|
|
373
|
+
state: fn(t)
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
function mn(e) {
|
|
377
|
+
let { role: t, timestamp: n, toolInvocations: r, ...i } = e;
|
|
378
|
+
return {
|
|
379
|
+
...i,
|
|
380
|
+
role: dn(t),
|
|
381
|
+
timestamp: un(n),
|
|
382
|
+
toolInvocations: r?.map(pn)
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
function hn(e) {
|
|
386
|
+
return (e ?? []).map(mn);
|
|
302
387
|
}
|
|
303
388
|
//#endregion
|
|
304
389
|
//#region src/useObjectChat.ts
|
|
305
|
-
var
|
|
306
|
-
function
|
|
390
|
+
var gn = "objectui:ai-usage-refresh";
|
|
391
|
+
function _n() {
|
|
307
392
|
if (!(typeof window > "u" || typeof window.dispatchEvent != "function")) try {
|
|
308
|
-
window.dispatchEvent(new CustomEvent(
|
|
393
|
+
window.dispatchEvent(new CustomEvent(gn));
|
|
309
394
|
} catch {}
|
|
310
395
|
}
|
|
311
|
-
async function
|
|
396
|
+
async function vn(e, t) {
|
|
312
397
|
let n;
|
|
313
398
|
try {
|
|
314
399
|
n = await fetch(e, t);
|
|
@@ -326,7 +411,7 @@ async function cn(e, t) {
|
|
|
326
411
|
}
|
|
327
412
|
return n;
|
|
328
413
|
}
|
|
329
|
-
function
|
|
414
|
+
function yn(e) {
|
|
330
415
|
let t = [...e.messages].reverse().find((e) => e.role === "user");
|
|
331
416
|
return { body: {
|
|
332
417
|
...e.body ?? {},
|
|
@@ -337,7 +422,7 @@ function ln(e) {
|
|
|
337
422
|
...t ? { turnId: t.id } : {}
|
|
338
423
|
} };
|
|
339
424
|
}
|
|
340
|
-
function
|
|
425
|
+
function bn(e, t) {
|
|
341
426
|
let n = e.context ?? {};
|
|
342
427
|
return {
|
|
343
428
|
...e,
|
|
@@ -347,25 +432,33 @@ function un(e, t) {
|
|
|
347
432
|
}
|
|
348
433
|
};
|
|
349
434
|
}
|
|
350
|
-
|
|
435
|
+
var xn = /* @__PURE__ */ new Set();
|
|
436
|
+
function Sn() {
|
|
437
|
+
xn.has("maxToolRoundtrips") || (xn.add("maxToolRoundtrips"), console.warn("[@object-ui/plugin-chatbot] `maxToolRoundtrips` is deprecated and has no effect: the installed chat runtime exposes no client-side round-trip cap (`useChat` dropped the numeric knob, and the surviving `stopWhen` / `stepCountIs` step cap is server-side only). Cap tool-calling loops on the agent instead — `planning.maxIterations`. This key is inert and is slated for removal in a future major (objectui#5605)."));
|
|
438
|
+
}
|
|
439
|
+
function Cn(e) {
|
|
351
440
|
return (e ?? []).map((e, t) => ({
|
|
352
441
|
id: e.id || `msg-${t}`,
|
|
353
442
|
role: e.role || "user",
|
|
354
443
|
content: e.content || "",
|
|
355
|
-
timestamp:
|
|
444
|
+
timestamp: un(e.timestamp),
|
|
356
445
|
metadata: e.metadata,
|
|
357
446
|
streaming: e.streaming,
|
|
358
447
|
toolInvocations: e.toolInvocations
|
|
359
448
|
}));
|
|
360
449
|
}
|
|
361
|
-
function
|
|
362
|
-
let { api: t, initialMessages: n, conversationId: r, parentConversationId: i, systemPrompt: a, model: s, streamingEnabled: f = !0, headers: p, body: m, maxToolRoundtrips: h
|
|
450
|
+
function wn(e = {}) {
|
|
451
|
+
let { api: t, initialMessages: n, conversationId: r, parentConversationId: i, systemPrompt: a, model: s, streamingEnabled: f = !0, headers: p, body: m, maxToolRoundtrips: h, onError: g, showTimestamp: _, autoResponse: v, autoResponseText: y, autoResponseDelay: b = 1e3, onSend: x } = e;
|
|
452
|
+
c(() => {
|
|
453
|
+
h !== void 0 && Sn();
|
|
454
|
+
}, [h]);
|
|
455
|
+
let S = u(t ? "api" : "local").current === "api", C = l(() => (n ?? []).map((e, t) => {
|
|
363
456
|
if (Array.isArray(e.parts) && e.parts.length > 0) return {
|
|
364
457
|
id: e.id || `msg-${t}`,
|
|
365
458
|
role: e.role || "user",
|
|
366
459
|
parts: e.parts
|
|
367
460
|
};
|
|
368
|
-
let n =
|
|
461
|
+
let n = Cn([e])[0], r = [];
|
|
369
462
|
n.content && r.push({
|
|
370
463
|
type: "text",
|
|
371
464
|
text: n.content
|
|
@@ -397,100 +490,108 @@ function fn(e = {}) {
|
|
|
397
490
|
let e = E.current;
|
|
398
491
|
E.current = i, i && !e && (T.current = i);
|
|
399
492
|
}, [i]);
|
|
400
|
-
let D =
|
|
493
|
+
let D = u(m);
|
|
494
|
+
D.current = m;
|
|
495
|
+
let O = u(p);
|
|
496
|
+
O.current = p;
|
|
497
|
+
let k = l(() => {
|
|
401
498
|
if (S) return new Ct({
|
|
402
499
|
api: t,
|
|
403
|
-
fetch:
|
|
404
|
-
headers: { ...p },
|
|
500
|
+
fetch: vn,
|
|
405
501
|
body: {
|
|
406
|
-
...m,
|
|
407
502
|
...r ? { conversationId: r } : {},
|
|
408
503
|
...s ? { model: s } : {},
|
|
409
504
|
...a ? { systemPrompt: a } : {},
|
|
410
505
|
...f === void 0 ? {} : { stream: f }
|
|
411
506
|
},
|
|
412
|
-
prepareSendMessagesRequest: ({ id: e, body: t, messages: n, trigger: r, messageId: i }) => {
|
|
413
|
-
let
|
|
507
|
+
prepareSendMessagesRequest: ({ id: e, body: t, messages: n, trigger: r, messageId: i, headers: a }) => {
|
|
508
|
+
let o = yn({
|
|
414
509
|
id: e,
|
|
415
|
-
body:
|
|
510
|
+
body: {
|
|
511
|
+
...D.current,
|
|
512
|
+
...t
|
|
513
|
+
},
|
|
416
514
|
messages: n,
|
|
417
515
|
trigger: r,
|
|
418
516
|
messageId: i
|
|
419
517
|
});
|
|
420
|
-
|
|
518
|
+
w.current && (o.body.model = w.current), T.current &&= (o.body = bn(o.body, T.current), void 0);
|
|
519
|
+
let s = new Headers(O.current ?? {});
|
|
520
|
+
return new Headers(a ?? {}).forEach((e, t) => s.set(t, e)), {
|
|
521
|
+
...o,
|
|
522
|
+
headers: s
|
|
523
|
+
};
|
|
421
524
|
}
|
|
422
525
|
});
|
|
423
526
|
}, [
|
|
424
527
|
S,
|
|
425
528
|
t,
|
|
426
|
-
p,
|
|
427
|
-
m,
|
|
428
529
|
s,
|
|
429
530
|
a,
|
|
430
531
|
f,
|
|
431
532
|
r
|
|
432
|
-
]),
|
|
433
|
-
transport:
|
|
533
|
+
]), A = u(null), j = St({
|
|
534
|
+
transport: k,
|
|
434
535
|
messages: S && C.length > 0 ? C : void 0,
|
|
435
536
|
onError: S ? (e) => {
|
|
436
537
|
if (e.notSent) {
|
|
437
|
-
let e =
|
|
438
|
-
e?.setMessages && t && t.length > 0 && t[t.length - 1]?.role === "user" && e.setMessages(t.slice(0, -1)),
|
|
538
|
+
let e = A.current, t = e?.messages;
|
|
539
|
+
e?.setMessages && t && t.length > 0 && t[t.length - 1]?.role === "user" && e.setMessages(t.slice(0, -1)), _n();
|
|
439
540
|
}
|
|
440
541
|
g?.(e);
|
|
441
542
|
} : void 0
|
|
442
543
|
});
|
|
443
|
-
|
|
444
|
-
let
|
|
544
|
+
A.current = j;
|
|
545
|
+
let M = u(void 0), N = j?.status;
|
|
445
546
|
c(() => {
|
|
446
|
-
let e =
|
|
447
|
-
|
|
448
|
-
}, [
|
|
449
|
-
let [
|
|
547
|
+
let e = M.current;
|
|
548
|
+
M.current = N, (e === "streaming" || e === "submitted") && N === "ready" && _n();
|
|
549
|
+
}, [N]);
|
|
550
|
+
let [ee, P] = d(() => Cn(n)), [F, I] = d(!1), [te, ne] = d(""), [L, re] = d(""), ie = u(null);
|
|
450
551
|
c(() => () => {
|
|
451
|
-
|
|
552
|
+
ie.current &&= (clearTimeout(ie.current), null);
|
|
452
553
|
}, []);
|
|
453
|
-
let { messages:
|
|
554
|
+
let { messages: R, status: ae, error: oe, sendMessage: z, regenerate: B, stop: se, setMessages: V } = j, ce = ae === "submitted" || ae === "streaming", le = ln(R, { isStreaming: ce }).map((e, t) => ({
|
|
454
555
|
...e,
|
|
455
|
-
metadata:
|
|
456
|
-
})),
|
|
556
|
+
metadata: R[t]?.metadata
|
|
557
|
+
})), ue = o((e) => {
|
|
457
558
|
let t = e.trim();
|
|
458
559
|
if (!t) return;
|
|
459
|
-
let n = [...
|
|
460
|
-
id:
|
|
560
|
+
let n = [...le, {
|
|
561
|
+
id: Ht("msg"),
|
|
461
562
|
role: "user",
|
|
462
563
|
content: t
|
|
463
564
|
}];
|
|
464
|
-
|
|
565
|
+
z({ text: t }), re(""), x?.(t, n);
|
|
465
566
|
}, [
|
|
466
|
-
|
|
567
|
+
z,
|
|
467
568
|
x,
|
|
468
|
-
|
|
469
|
-
]),
|
|
470
|
-
|
|
471
|
-
}, [
|
|
472
|
-
|
|
473
|
-
}, []),
|
|
474
|
-
|
|
475
|
-
}, []),
|
|
569
|
+
le
|
|
570
|
+
]), de = o(() => {
|
|
571
|
+
V([]);
|
|
572
|
+
}, [V]), fe = o((e) => {
|
|
573
|
+
re(e.target.value);
|
|
574
|
+
}, []), pe = o(() => {
|
|
575
|
+
ie.current &&= (clearTimeout(ie.current), null), I(!1);
|
|
576
|
+
}, []), me = o((e) => {
|
|
476
577
|
if (!e.trim()) return;
|
|
477
578
|
let t = {
|
|
478
|
-
id:
|
|
579
|
+
id: Ht("msg"),
|
|
479
580
|
role: "user",
|
|
480
581
|
content: e.trim(),
|
|
481
582
|
timestamp: _ ? (/* @__PURE__ */ new Date()).toLocaleTimeString() : void 0
|
|
482
583
|
};
|
|
483
|
-
|
|
584
|
+
P((n) => {
|
|
484
585
|
let r = [...n, t];
|
|
485
586
|
return x?.(e.trim(), r), r;
|
|
486
|
-
}),
|
|
587
|
+
}), ne(""), v && (I(!0), ie.current = setTimeout(() => {
|
|
487
588
|
let e = {
|
|
488
|
-
id:
|
|
589
|
+
id: Ht("msg"),
|
|
489
590
|
role: "assistant",
|
|
490
591
|
content: y || "Thank you for your message!",
|
|
491
592
|
timestamp: _ ? (/* @__PURE__ */ new Date()).toLocaleTimeString() : void 0
|
|
492
593
|
};
|
|
493
|
-
|
|
594
|
+
P((t) => [...t, e]), I(!1);
|
|
494
595
|
}, b));
|
|
495
596
|
}, [
|
|
496
597
|
_,
|
|
@@ -498,65 +599,65 @@ function fn(e = {}) {
|
|
|
498
599
|
y,
|
|
499
600
|
b,
|
|
500
601
|
x
|
|
501
|
-
]),
|
|
502
|
-
|
|
503
|
-
}, [
|
|
504
|
-
|
|
602
|
+
]), he = o(() => {}, []), ge = o(() => {
|
|
603
|
+
pe(), P([]);
|
|
604
|
+
}, [pe]), _e = o((e) => {
|
|
605
|
+
ne(e.target.value);
|
|
505
606
|
}, []);
|
|
506
607
|
return S ? {
|
|
507
|
-
messages:
|
|
508
|
-
isLoading:
|
|
509
|
-
error:
|
|
510
|
-
sendMessage:
|
|
511
|
-
stop:
|
|
512
|
-
reload:
|
|
513
|
-
clear:
|
|
514
|
-
setMessages:
|
|
608
|
+
messages: le,
|
|
609
|
+
isLoading: ce,
|
|
610
|
+
error: oe,
|
|
611
|
+
sendMessage: ue,
|
|
612
|
+
stop: se,
|
|
613
|
+
reload: B,
|
|
614
|
+
clear: de,
|
|
615
|
+
setMessages: V,
|
|
515
616
|
isApiMode: !0,
|
|
516
|
-
input:
|
|
517
|
-
setInput:
|
|
518
|
-
handleInputChange:
|
|
617
|
+
input: L,
|
|
618
|
+
setInput: re,
|
|
619
|
+
handleInputChange: fe
|
|
519
620
|
} : {
|
|
520
|
-
messages:
|
|
521
|
-
isLoading:
|
|
621
|
+
messages: ee,
|
|
622
|
+
isLoading: F,
|
|
522
623
|
error: void 0,
|
|
523
|
-
sendMessage:
|
|
524
|
-
stop:
|
|
525
|
-
reload:
|
|
526
|
-
clear:
|
|
624
|
+
sendMessage: me,
|
|
625
|
+
stop: pe,
|
|
626
|
+
reload: he,
|
|
627
|
+
clear: ge,
|
|
527
628
|
isApiMode: !1,
|
|
528
|
-
input:
|
|
529
|
-
setInput:
|
|
530
|
-
handleInputChange:
|
|
629
|
+
input: te,
|
|
630
|
+
setInput: ne,
|
|
631
|
+
handleInputChange: _e
|
|
531
632
|
};
|
|
532
633
|
}
|
|
533
634
|
//#endregion
|
|
534
635
|
//#region src/agentAliases.ts
|
|
535
|
-
var
|
|
536
|
-
function
|
|
537
|
-
return
|
|
636
|
+
var Tn = [["build", "metadata_assistant"], ["ask", "data_chat"]];
|
|
637
|
+
function En(e) {
|
|
638
|
+
return Tn.find((t) => t.includes(e)) ?? [e];
|
|
538
639
|
}
|
|
539
|
-
function
|
|
540
|
-
return
|
|
640
|
+
function Dn(e) {
|
|
641
|
+
return En(e)[0];
|
|
541
642
|
}
|
|
542
|
-
function
|
|
643
|
+
function On(e, t) {
|
|
543
644
|
if (e) {
|
|
544
645
|
if (t.includes(e)) return e;
|
|
545
|
-
for (let n of
|
|
646
|
+
for (let n of En(e)) if (t.includes(n)) return n;
|
|
546
647
|
}
|
|
547
648
|
}
|
|
548
|
-
function
|
|
549
|
-
return e != null &&
|
|
649
|
+
function kn(e) {
|
|
650
|
+
return e != null && Tn.some((t) => t.includes(e));
|
|
550
651
|
}
|
|
551
|
-
function
|
|
552
|
-
return e != null &&
|
|
652
|
+
function An(e) {
|
|
653
|
+
return e != null && Dn(e) === "build";
|
|
553
654
|
}
|
|
554
|
-
function
|
|
555
|
-
return e != null &&
|
|
655
|
+
function jn(e) {
|
|
656
|
+
return e != null && Dn(e) === "ask";
|
|
556
657
|
}
|
|
557
658
|
//#endregion
|
|
558
659
|
//#region src/useAgents.ts
|
|
559
|
-
function
|
|
660
|
+
function Mn(e) {
|
|
560
661
|
if (!(!e || typeof e != "object")) return {
|
|
561
662
|
authoring: e.authoring === !0,
|
|
562
663
|
canvas: e.canvas === !0,
|
|
@@ -564,45 +665,45 @@ function bn(e) {
|
|
|
564
665
|
resume: e.resume === !0
|
|
565
666
|
};
|
|
566
667
|
}
|
|
567
|
-
function
|
|
668
|
+
function Nn(e, t, n) {
|
|
568
669
|
if (!t) return !1;
|
|
569
670
|
let r = e.find((e) => e.name === t);
|
|
570
|
-
return r?.capabilities ? r.capabilities[n] :
|
|
671
|
+
return r?.capabilities ? r.capabilities[n] : An(t);
|
|
571
672
|
}
|
|
572
|
-
var
|
|
573
|
-
function
|
|
673
|
+
var Pn = "ask";
|
|
674
|
+
function Fn(e, t) {
|
|
574
675
|
if (e.length === 0) return;
|
|
575
676
|
let n = e.map((e) => e.name);
|
|
576
677
|
if (t) {
|
|
577
|
-
let e =
|
|
678
|
+
let e = On(t, n);
|
|
578
679
|
if (e) return e;
|
|
579
680
|
}
|
|
580
|
-
return
|
|
681
|
+
return On("ask", n) || e[0].name;
|
|
581
682
|
}
|
|
582
|
-
function
|
|
683
|
+
function In(e) {
|
|
583
684
|
let t = e && typeof e == "object" && !Array.isArray(e) && typeof e.success == "boolean" ? e.data : e;
|
|
584
685
|
if (Array.isArray(t)) return t;
|
|
585
686
|
let n = t?.agents;
|
|
586
687
|
return Array.isArray(n) ? n : [];
|
|
587
688
|
}
|
|
588
|
-
function
|
|
689
|
+
function Ln(e) {
|
|
589
690
|
return e.filter((e) => typeof e?.name == "string" && e.name.length > 0).map((e) => ({
|
|
590
691
|
name: e.name,
|
|
591
692
|
label: e.label || e.name,
|
|
592
693
|
description: e.description,
|
|
593
694
|
role: e.role,
|
|
594
695
|
active: e.active !== !1,
|
|
595
|
-
capabilities:
|
|
696
|
+
capabilities: Mn(e.capabilities)
|
|
596
697
|
}));
|
|
597
698
|
}
|
|
598
|
-
var
|
|
599
|
-
function
|
|
600
|
-
if (n)
|
|
699
|
+
var Rn = 3e4, zn = /* @__PURE__ */ new Map(), Bn = /* @__PURE__ */ new Map();
|
|
700
|
+
function Vn(e, t, n) {
|
|
701
|
+
if (n) zn.delete(e);
|
|
601
702
|
else {
|
|
602
|
-
let t =
|
|
603
|
-
if (t && Date.now() - t.timestamp <
|
|
703
|
+
let t = zn.get(e);
|
|
704
|
+
if (t && Date.now() - t.timestamp < Rn) return Promise.resolve(t.data);
|
|
604
705
|
}
|
|
605
|
-
let r =
|
|
706
|
+
let r = Bn.get(e);
|
|
606
707
|
if (r && !n) return r;
|
|
607
708
|
let i = `${e.replace(/\/$/, "")}/agents`, a = fetch(i, {
|
|
608
709
|
method: "GET",
|
|
@@ -613,21 +714,21 @@ function kn(e, t, n) {
|
|
|
613
714
|
credentials: "include"
|
|
614
715
|
}).then(async (e) => {
|
|
615
716
|
if (!e.ok) throw Error(`Failed to load agents (${e.status})`);
|
|
616
|
-
return
|
|
617
|
-
}).then((t) => (
|
|
717
|
+
return Ln(In(await e.json()));
|
|
718
|
+
}).then((t) => (zn.set(e, {
|
|
618
719
|
data: t,
|
|
619
720
|
timestamp: Date.now()
|
|
620
721
|
}), t)).finally(() => {
|
|
621
|
-
|
|
722
|
+
Bn.delete(e);
|
|
622
723
|
});
|
|
623
|
-
return
|
|
724
|
+
return Bn.set(e, a), a;
|
|
624
725
|
}
|
|
625
|
-
function
|
|
726
|
+
function Hn(e = {}) {
|
|
626
727
|
let { apiBase: t, headers: n, enabled: r = !0, fallback: i = [] } = e, [a, s] = d(i), [l, f] = d(!1), [p, m] = d(void 0), [h, g] = d(0), _ = u(n);
|
|
627
728
|
return _.current = n, c(() => {
|
|
628
729
|
if (!r || !t) return;
|
|
629
730
|
let e = !1;
|
|
630
|
-
return f(!0), m(void 0),
|
|
731
|
+
return f(!0), m(void 0), Vn(t, _.current, h > 0).then((t) => {
|
|
631
732
|
e || s(t.length > 0 ? t : i);
|
|
632
733
|
}).catch((t) => {
|
|
633
734
|
e || (m(t), s(i));
|
|
@@ -649,13 +750,13 @@ function An(e = {}) {
|
|
|
649
750
|
}
|
|
650
751
|
//#endregion
|
|
651
752
|
//#region src/useAiModels.ts
|
|
652
|
-
function
|
|
753
|
+
function Un(e) {
|
|
653
754
|
return e.filter((e) => typeof e?.id == "string" && e.id.length > 0).map((e) => ({
|
|
654
755
|
id: e.id,
|
|
655
756
|
label: e.label || e.id
|
|
656
757
|
}));
|
|
657
758
|
}
|
|
658
|
-
function
|
|
759
|
+
function Wn(e = {}) {
|
|
659
760
|
let { apiBase: t, headers: n, enabled: r = !0 } = e, [i, a] = d([]), [s, l] = d(void 0), [f, p] = d(!1), [m, h] = d(void 0), [g, _] = d(0), v = u(n);
|
|
660
761
|
return v.current = n, c(() => {
|
|
661
762
|
if (!r || !t) return;
|
|
@@ -675,7 +776,7 @@ function Mn(e = {}) {
|
|
|
675
776
|
if (!t.ok) throw Error(`Failed to load AI models (${t.status})`);
|
|
676
777
|
let r = await t.json();
|
|
677
778
|
if (n) return;
|
|
678
|
-
let c = Array.isArray(r) ? r : r?.models ?? [], u = Array.isArray(r) ? void 0 : r?.defaultModel, d =
|
|
779
|
+
let c = Array.isArray(r) ? r : r?.models ?? [], u = Array.isArray(r) ? void 0 : r?.defaultModel, d = Un(c);
|
|
679
780
|
a(d), l(u ?? c.find((e) => e?.default)?.id ?? c[0]?.id), p(!1), d.length === 0 && o < 5 && !n && (o += 1, setTimeout(() => {
|
|
680
781
|
s();
|
|
681
782
|
}, 1200));
|
|
@@ -704,8 +805,8 @@ function Mn(e = {}) {
|
|
|
704
805
|
}
|
|
705
806
|
//#endregion
|
|
706
807
|
//#region src/FloatingChatbotProvider.tsx
|
|
707
|
-
var
|
|
708
|
-
function
|
|
808
|
+
var Gn = e.createContext(null);
|
|
809
|
+
function Kn({ defaultOpen: t = !1, children: n }) {
|
|
709
810
|
let [r, i] = e.useState(t), [a, o] = e.useState(!1), s = e.useMemo(() => ({
|
|
710
811
|
isOpen: r,
|
|
711
812
|
isFullscreen: a,
|
|
@@ -716,26 +817,26 @@ function Pn({ defaultOpen: t = !1, children: n }) {
|
|
|
716
817
|
toggle: () => i((e) => !e),
|
|
717
818
|
toggleFullscreen: () => o((e) => !e)
|
|
718
819
|
}), [r, a]);
|
|
719
|
-
return /* @__PURE__ */ Z(
|
|
820
|
+
return /* @__PURE__ */ Z(Gn.Provider, {
|
|
720
821
|
value: s,
|
|
721
822
|
children: n
|
|
722
823
|
});
|
|
723
824
|
}
|
|
724
|
-
function
|
|
725
|
-
let t = e.useContext(
|
|
825
|
+
function qn() {
|
|
826
|
+
let t = e.useContext(Gn);
|
|
726
827
|
if (!t) throw Error("useFloatingChatbot must be used within a <FloatingChatbotProvider>");
|
|
727
828
|
return t;
|
|
728
829
|
}
|
|
729
830
|
//#endregion
|
|
730
831
|
//#region src/FloatingChatbotTrigger.tsx
|
|
731
|
-
function
|
|
732
|
-
let { t: e } =
|
|
832
|
+
function Jn() {
|
|
833
|
+
let { t: e } = Et();
|
|
733
834
|
return (t, n) => {
|
|
734
835
|
let r = e(`common.${t}`);
|
|
735
836
|
return !r || r === `common.${t}` ? n : r;
|
|
736
837
|
};
|
|
737
838
|
}
|
|
738
|
-
var
|
|
839
|
+
var Yn = {
|
|
739
840
|
32: "size-8",
|
|
740
841
|
36: "size-9",
|
|
741
842
|
40: "size-10",
|
|
@@ -748,26 +849,26 @@ var Ln = {
|
|
|
748
849
|
72: "size-[72px]",
|
|
749
850
|
80: "size-20"
|
|
750
851
|
};
|
|
751
|
-
function
|
|
852
|
+
function Xn(e, t) {
|
|
752
853
|
return t.reduce((t, n) => Math.abs(n - e) < Math.abs(t - e) ? n : t);
|
|
753
854
|
}
|
|
754
|
-
function
|
|
755
|
-
return
|
|
855
|
+
function Zn(e) {
|
|
856
|
+
return Yn[e] ?? Yn[Xn(e, Object.keys(Yn).map(Number))];
|
|
756
857
|
}
|
|
757
|
-
function
|
|
758
|
-
let { isOpen: r, toggle: i } =
|
|
858
|
+
function Qn({ position: e = "bottom-right", size: t = 56, className: n }) {
|
|
859
|
+
let { isOpen: r, toggle: i } = qn(), a = Jn();
|
|
759
860
|
return /* @__PURE__ */ Z(v, {
|
|
760
861
|
onClick: i,
|
|
761
|
-
className:
|
|
862
|
+
className: W("fixed z-50 rounded-full shadow-lg transition-transform hover:scale-105", Zn(t), r && "hidden", e === "bottom-right" ? "right-6 bottom-20 sm:bottom-6" : "left-6 bottom-20 sm:bottom-6", n),
|
|
762
863
|
size: "icon",
|
|
763
864
|
"aria-label": r ? a("closeChat", "Close chat") : a("openChat", "Open chat"),
|
|
764
865
|
"data-testid": "floating-chatbot-trigger",
|
|
765
|
-
children: Z(r ?
|
|
866
|
+
children: Z(r ? bt : Ie, { className: "h-6 w-6" })
|
|
766
867
|
});
|
|
767
868
|
}
|
|
768
869
|
//#endregion
|
|
769
870
|
//#region src/FloatingChatbotPanel.tsx
|
|
770
|
-
var
|
|
871
|
+
var $n = {
|
|
771
872
|
300: "sm:w-[300px]",
|
|
772
873
|
320: "sm:w-[320px]",
|
|
773
874
|
340: "sm:w-[340px]",
|
|
@@ -786,7 +887,7 @@ var Vn = {
|
|
|
786
887
|
640: "sm:w-[640px]",
|
|
787
888
|
720: "sm:w-[720px]",
|
|
788
889
|
800: "sm:w-[800px]"
|
|
789
|
-
},
|
|
890
|
+
}, er = {
|
|
790
891
|
360: "h-[min(360px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[360px]",
|
|
791
892
|
400: "h-[min(400px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[400px]",
|
|
792
893
|
420: "h-[min(420px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[420px]",
|
|
@@ -800,19 +901,19 @@ var Vn = {
|
|
|
800
901
|
720: "h-[min(720px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[720px]",
|
|
801
902
|
800: "h-[min(800px,calc(100svh_-_6rem_-_env(safe-area-inset-bottom)))] sm:h-[800px]"
|
|
802
903
|
};
|
|
803
|
-
function
|
|
904
|
+
function tr(e, t) {
|
|
804
905
|
return t.reduce((t, n) => Math.abs(n - e) < Math.abs(t - e) ? n : t);
|
|
805
906
|
}
|
|
806
|
-
function
|
|
807
|
-
return
|
|
907
|
+
function nr(e) {
|
|
908
|
+
return $n[e] ?? $n[tr(e, Object.keys($n).map(Number))];
|
|
808
909
|
}
|
|
809
|
-
function
|
|
810
|
-
return
|
|
910
|
+
function rr(e) {
|
|
911
|
+
return er[e] ?? er[tr(e, Object.keys(er).map(Number))];
|
|
811
912
|
}
|
|
812
|
-
function
|
|
813
|
-
let { isOpen: c, isFullscreen: l, close: u, toggleFullscreen: d } =
|
|
913
|
+
function ir({ title: e = "Chat", position: t = "bottom-right", width: n = 400, height: r = 520, children: i, className: a, headerExtra: o, headerActions: s }) {
|
|
914
|
+
let { isOpen: c, isFullscreen: l, close: u, toggleFullscreen: d } = qn();
|
|
814
915
|
return c ? /* @__PURE__ */ Q("div", {
|
|
815
|
-
className:
|
|
916
|
+
className: W("fixed z-50 flex flex-col overflow-hidden border bg-background shadow-xl transition-all", l ? "inset-0 h-svh w-screen rounded-none" : t === "bottom-right" ? W("left-3 right-3 bottom-[calc(4rem_+_env(safe-area-inset-bottom))] rounded-lg", "sm:left-auto sm:right-6 sm:bottom-20 sm:max-h-[calc(100vh_-_100px)]", nr(n), rr(r)) : W("left-3 right-3 bottom-[calc(4rem_+_env(safe-area-inset-bottom))] rounded-lg", "sm:right-auto sm:left-6 sm:bottom-20 sm:max-h-[calc(100vh_-_100px)]", nr(n), rr(r)), a),
|
|
816
917
|
role: "dialog",
|
|
817
918
|
"aria-label": e,
|
|
818
919
|
"data-testid": "floating-chatbot-panel",
|
|
@@ -839,7 +940,7 @@ function Kn({ title: e = "Chat", position: t = "bottom-right", width: n = 400, h
|
|
|
839
940
|
onClick: d,
|
|
840
941
|
"aria-label": l ? "Exit fullscreen" : "Fullscreen",
|
|
841
942
|
"data-testid": "floating-chatbot-fullscreen",
|
|
842
|
-
children: Z(l ?
|
|
943
|
+
children: Z(l ? q : ot, { className: "h-4 w-4" })
|
|
843
944
|
}),
|
|
844
945
|
/* @__PURE__ */ Z(v, {
|
|
845
946
|
variant: "ghost",
|
|
@@ -848,7 +949,7 @@ function Kn({ title: e = "Chat", position: t = "bottom-right", width: n = 400, h
|
|
|
848
949
|
onClick: u,
|
|
849
950
|
"aria-label": "Close chat",
|
|
850
951
|
"data-testid": "floating-chatbot-close",
|
|
851
|
-
children: /* @__PURE__ */ Z(
|
|
952
|
+
children: /* @__PURE__ */ Z(bt, { className: "h-4 w-4" })
|
|
852
953
|
})
|
|
853
954
|
]
|
|
854
955
|
})
|
|
@@ -861,7 +962,7 @@ function Kn({ title: e = "Chat", position: t = "bottom-right", width: n = 400, h
|
|
|
861
962
|
}
|
|
862
963
|
//#endregion
|
|
863
964
|
//#region src/tool-display.ts
|
|
864
|
-
var
|
|
965
|
+
var ar = {
|
|
865
966
|
ai: "AI",
|
|
866
967
|
api: "API",
|
|
867
968
|
crm: "CRM",
|
|
@@ -873,17 +974,17 @@ var qn = {
|
|
|
873
974
|
url: "URL",
|
|
874
975
|
utc: "UTC"
|
|
875
976
|
};
|
|
876
|
-
function
|
|
977
|
+
function or(e) {
|
|
877
978
|
if (!e) return "";
|
|
878
979
|
let t = String(e).trim();
|
|
879
980
|
if (!t) return "";
|
|
880
981
|
let n = t.replace(/[_-]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").split(/\s+/).filter(Boolean);
|
|
881
982
|
return n.length === 0 ? t : n.map((e, t) => {
|
|
882
983
|
let n = e.toLowerCase();
|
|
883
|
-
return
|
|
984
|
+
return ar[n] ? ar[n] : t === 0 ? n.charAt(0).toUpperCase() + n.slice(1) : n;
|
|
884
985
|
}).join(" ");
|
|
885
986
|
}
|
|
886
|
-
function
|
|
987
|
+
function sr(e) {
|
|
887
988
|
if (e == null) return e;
|
|
888
989
|
let t = e;
|
|
889
990
|
for (let e = 0; e < 2; e++) {
|
|
@@ -901,7 +1002,7 @@ function Yn(e) {
|
|
|
901
1002
|
}
|
|
902
1003
|
return t;
|
|
903
1004
|
}
|
|
904
|
-
function
|
|
1005
|
+
function cr(e) {
|
|
905
1006
|
let t = (e instanceof Error ? e.message : String(e ?? "")).replace(/\s+/g, " ").trim();
|
|
906
1007
|
if (!t) return { summary: "Something went wrong. Please try again." };
|
|
907
1008
|
let n = t.replace(/^Failed after \d+ attempts?\.\s*Last error:\s*/i, ""), r = n.match(/^Invalid error response format:\s*(.+)$/i)?.[1]?.trim() ?? n, i = r.match(/^([^:]{8,80}):\s+(.+)$/)?.[1]?.trim() ?? r.match(/^([^.;!?]+[.;!?])\s/)?.[1]?.trim() ?? (r.length > 140 ? `${r.slice(0, 137).trimEnd()}…` : r);
|
|
@@ -910,12 +1011,18 @@ function Xn(e) {
|
|
|
910
1011
|
details: n.length > i.length ? n : void 0
|
|
911
1012
|
};
|
|
912
1013
|
}
|
|
913
|
-
var
|
|
1014
|
+
var lr = /* @__PURE__ */ new Set([
|
|
914
1015
|
"ai_design_quota_exhausted",
|
|
915
1016
|
"ai_data_chat_trial_exhausted",
|
|
916
1017
|
"ai_allowance_exhausted"
|
|
917
1018
|
]);
|
|
918
|
-
function
|
|
1019
|
+
function ur(e) {
|
|
1020
|
+
return typeof e == "string" && lr.has(e) ? e : void 0;
|
|
1021
|
+
}
|
|
1022
|
+
function dr(e) {
|
|
1023
|
+
return typeof e == "string" && e.trim() ? e : void 0;
|
|
1024
|
+
}
|
|
1025
|
+
function fr(e) {
|
|
919
1026
|
let t = e instanceof Error ? e.message : String(e ?? "");
|
|
920
1027
|
if (!t) return null;
|
|
921
1028
|
let n = t.replace(/^Failed after \d+ attempts?\.\s*Last error:\s*/i, "").replace(/^Invalid error response format:\s*/i, "").trim(), r = n.indexOf("{"), i = n.lastIndexOf("}");
|
|
@@ -926,39 +1033,41 @@ function Qn(e) {
|
|
|
926
1033
|
} catch {
|
|
927
1034
|
return null;
|
|
928
1035
|
}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
1036
|
+
if (!a || typeof a != "object") return null;
|
|
1037
|
+
let o = a.error && typeof a.error == "object" ? a.error : void 0, s = ur(a.error), c = ur(o?.code) ?? s ?? ur(a.code);
|
|
1038
|
+
return c ? {
|
|
1039
|
+
code: c,
|
|
1040
|
+
message: dr(o?.message) ?? dr(a.message) ?? (s ? void 0 : dr(a.error)) ?? "",
|
|
1041
|
+
messageEn: dr(a.messageEn),
|
|
933
1042
|
upgrade: a.upgrade === !0,
|
|
934
1043
|
topUp: a.topUp === !0
|
|
935
|
-
};
|
|
1044
|
+
} : null;
|
|
936
1045
|
}
|
|
937
|
-
function
|
|
1046
|
+
function pr(e) {
|
|
938
1047
|
return !!(e && typeof e == "object" && e.notSent === !0);
|
|
939
1048
|
}
|
|
940
|
-
function
|
|
1049
|
+
function mr(e) {
|
|
941
1050
|
let t = e && typeof e == "object" ? e.status : void 0;
|
|
942
1051
|
return typeof t == "number" ? t : void 0;
|
|
943
1052
|
}
|
|
944
|
-
function
|
|
945
|
-
if (
|
|
1053
|
+
function hr(e) {
|
|
1054
|
+
if (mr(e) === 429) return !0;
|
|
946
1055
|
let t = e instanceof Error ? e.message : typeof e == "string" ? e : "";
|
|
947
1056
|
return /\b429\b|too many requests|rate[\s_-]?limit/i.test(t);
|
|
948
1057
|
}
|
|
949
1058
|
//#endregion
|
|
950
1059
|
//#region src/elements/conversation.tsx
|
|
951
|
-
var
|
|
952
|
-
className:
|
|
1060
|
+
var gr = ({ className: e, ...t }) => /* @__PURE__ */ Z(kt, {
|
|
1061
|
+
className: W("relative flex-1 overflow-y-hidden", e),
|
|
953
1062
|
initial: "smooth",
|
|
954
1063
|
resize: "smooth",
|
|
955
1064
|
role: "log",
|
|
956
1065
|
...t
|
|
957
|
-
}),
|
|
958
|
-
className:
|
|
1066
|
+
}), _r = ({ className: e, ...t }) => /* @__PURE__ */ Z(kt.Content, {
|
|
1067
|
+
className: W("flex flex-col gap-8 p-4", e),
|
|
959
1068
|
...t
|
|
960
|
-
}),
|
|
961
|
-
className:
|
|
1069
|
+
}), vr = ({ className: e, title: t = "No messages yet", description: n = "Start a conversation to see messages here", icon: r, children: i, ...a }) => /* @__PURE__ */ Z("div", {
|
|
1070
|
+
className: W("flex size-full flex-col items-center justify-center gap-3 p-8 text-center", e),
|
|
962
1071
|
...a,
|
|
963
1072
|
children: i ?? /* @__PURE__ */ Q(X, { children: [r && /* @__PURE__ */ Z("div", {
|
|
964
1073
|
className: "text-muted-foreground",
|
|
@@ -973,55 +1082,55 @@ var nr = ({ className: e, ...t }) => /* @__PURE__ */ Z(Ot, {
|
|
|
973
1082
|
children: n
|
|
974
1083
|
})]
|
|
975
1084
|
})] })
|
|
976
|
-
}),
|
|
977
|
-
let { isAtBottom: n, scrollToBottom: r } =
|
|
1085
|
+
}), yr = ({ className: e, ...t }) => {
|
|
1086
|
+
let { isAtBottom: n, scrollToBottom: r } = At(), i = o(() => {
|
|
978
1087
|
r();
|
|
979
1088
|
}, [r]);
|
|
980
1089
|
return !n && /* @__PURE__ */ Z(v, {
|
|
981
|
-
className:
|
|
1090
|
+
className: W("absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full", e),
|
|
982
1091
|
onClick: i,
|
|
983
1092
|
size: "icon",
|
|
984
1093
|
type: "button",
|
|
985
1094
|
variant: "outline",
|
|
986
1095
|
...t,
|
|
987
|
-
children: /* @__PURE__ */ Z(
|
|
1096
|
+
children: /* @__PURE__ */ Z(Ne, { className: "size-4" })
|
|
988
1097
|
});
|
|
989
|
-
},
|
|
1098
|
+
}, br = jt("flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1", {
|
|
990
1099
|
variants: { orientation: {
|
|
991
1100
|
horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
|
|
992
1101
|
vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"
|
|
993
1102
|
} },
|
|
994
1103
|
defaultVariants: { orientation: "horizontal" }
|
|
995
1104
|
});
|
|
996
|
-
function
|
|
1105
|
+
function xr({ className: e, orientation: t, ...n }) {
|
|
997
1106
|
return /* @__PURE__ */ Z("div", {
|
|
998
1107
|
role: "group",
|
|
999
1108
|
"data-slot": "button-group",
|
|
1000
1109
|
"data-orientation": t,
|
|
1001
|
-
className:
|
|
1110
|
+
className: W(br({ orientation: t }), e),
|
|
1002
1111
|
...n
|
|
1003
1112
|
});
|
|
1004
1113
|
}
|
|
1005
|
-
function
|
|
1006
|
-
return /* @__PURE__ */ Z(t ?
|
|
1007
|
-
className:
|
|
1114
|
+
function Sr({ className: e, asChild: t = !1, ...n }) {
|
|
1115
|
+
return /* @__PURE__ */ Z(t ? Mt : "div", {
|
|
1116
|
+
className: W("flex items-center gap-2 rounded-md border bg-muted px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", e),
|
|
1008
1117
|
...n
|
|
1009
1118
|
});
|
|
1010
1119
|
}
|
|
1011
1120
|
//#endregion
|
|
1012
1121
|
//#region src/elements/message.tsx
|
|
1013
|
-
var
|
|
1014
|
-
className:
|
|
1122
|
+
var Cr = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Z("div", {
|
|
1123
|
+
className: W("group flex w-full max-w-[95%] flex-col gap-2", t === "user" ? "is-user ml-auto justify-end" : "is-assistant", e),
|
|
1015
1124
|
...n
|
|
1016
|
-
}),
|
|
1017
|
-
className:
|
|
1125
|
+
}), wr = ({ children: e, className: t, ...n }) => /* @__PURE__ */ Z("div", {
|
|
1126
|
+
className: W("is-user:dark flex w-fit max-w-full min-w-0 flex-col gap-2 overflow-hidden text-sm", "group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground", "group-[.is-assistant]:text-foreground", t),
|
|
1018
1127
|
...n,
|
|
1019
1128
|
children: e
|
|
1020
|
-
}),
|
|
1021
|
-
className:
|
|
1129
|
+
}), Tr = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Z("div", {
|
|
1130
|
+
className: W("flex items-center gap-1", e),
|
|
1022
1131
|
...n,
|
|
1023
1132
|
children: t
|
|
1024
|
-
}),
|
|
1133
|
+
}), Er = ({ tooltip: e, children: t, label: n, variant: r = "ghost", size: i = "icon", ...a }) => {
|
|
1025
1134
|
let o = /* @__PURE__ */ Q(v, {
|
|
1026
1135
|
size: i,
|
|
1027
1136
|
type: "button",
|
|
@@ -1032,15 +1141,15 @@ var lr = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Z("div", {
|
|
|
1032
1141
|
children: n || e
|
|
1033
1142
|
})]
|
|
1034
1143
|
});
|
|
1035
|
-
return e ? /* @__PURE__ */ Z(
|
|
1144
|
+
return e ? /* @__PURE__ */ Z(Ae, { children: /* @__PURE__ */ Q(Oe, { children: [/* @__PURE__ */ Z(je, {
|
|
1036
1145
|
asChild: !0,
|
|
1037
1146
|
children: o
|
|
1038
|
-
}), /* @__PURE__ */ Z(
|
|
1039
|
-
},
|
|
1040
|
-
let e = s(
|
|
1147
|
+
}), /* @__PURE__ */ Z(ke, { children: /* @__PURE__ */ Z("p", { children: e }) })] }) }) : o;
|
|
1148
|
+
}, Dr = r(null), Or = () => {
|
|
1149
|
+
let e = s(Dr);
|
|
1041
1150
|
if (!e) throw Error("MessageBranch components must be used within MessageBranch");
|
|
1042
1151
|
return e;
|
|
1043
|
-
},
|
|
1152
|
+
}, kr = ({ defaultBranch: e = 0, onBranchChange: t, className: n, ...r }) => {
|
|
1044
1153
|
let [i, a] = d(e), [o, s] = d([]), c = (e) => {
|
|
1045
1154
|
a(e), t?.(e);
|
|
1046
1155
|
}, l = {
|
|
@@ -1057,15 +1166,15 @@ var lr = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Z("div", {
|
|
|
1057
1166
|
branches: o,
|
|
1058
1167
|
setBranches: s
|
|
1059
1168
|
};
|
|
1060
|
-
return /* @__PURE__ */ Z(
|
|
1169
|
+
return /* @__PURE__ */ Z(Dr.Provider, {
|
|
1061
1170
|
value: l,
|
|
1062
1171
|
children: /* @__PURE__ */ Z("div", {
|
|
1063
|
-
className:
|
|
1172
|
+
className: W("grid w-full gap-2 [&>div]:pb-0", n),
|
|
1064
1173
|
...r
|
|
1065
1174
|
})
|
|
1066
1175
|
});
|
|
1067
|
-
},
|
|
1068
|
-
let { currentBranch: n, setBranches: r, branches: i } =
|
|
1176
|
+
}, Ar = ({ children: e, ...t }) => {
|
|
1177
|
+
let { currentBranch: n, setBranches: r, branches: i } = Or(), a = Array.isArray(e) ? e : [e];
|
|
1069
1178
|
return c(() => {
|
|
1070
1179
|
i.length !== a.length && r(a);
|
|
1071
1180
|
}, [
|
|
@@ -1073,19 +1182,19 @@ var lr = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Z("div", {
|
|
|
1073
1182
|
i,
|
|
1074
1183
|
r
|
|
1075
1184
|
]), a.map((e, r) => /* @__PURE__ */ Z("div", {
|
|
1076
|
-
className:
|
|
1185
|
+
className: W("grid gap-2 overflow-hidden [&>div]:pb-0", r === n ? "block" : "hidden"),
|
|
1077
1186
|
...t,
|
|
1078
1187
|
children: e
|
|
1079
1188
|
}, e.key));
|
|
1080
|
-
},
|
|
1081
|
-
let { totalBranches: r } =
|
|
1082
|
-
return r <= 1 ? null : /* @__PURE__ */ Z(
|
|
1189
|
+
}, jr = ({ className: e, from: t, ...n }) => {
|
|
1190
|
+
let { totalBranches: r } = Or();
|
|
1191
|
+
return r <= 1 ? null : /* @__PURE__ */ Z(xr, {
|
|
1083
1192
|
className: "[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md",
|
|
1084
1193
|
orientation: "horizontal",
|
|
1085
1194
|
...n
|
|
1086
1195
|
});
|
|
1087
|
-
},
|
|
1088
|
-
let { goToPrevious: n, totalBranches: r } =
|
|
1196
|
+
}, Mr = ({ children: e, ...t }) => {
|
|
1197
|
+
let { goToPrevious: n, totalBranches: r } = Or();
|
|
1089
1198
|
return /* @__PURE__ */ Z(v, {
|
|
1090
1199
|
"aria-label": "Previous branch",
|
|
1091
1200
|
disabled: r <= 1,
|
|
@@ -1094,10 +1203,10 @@ var lr = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Z("div", {
|
|
|
1094
1203
|
type: "button",
|
|
1095
1204
|
variant: "ghost",
|
|
1096
1205
|
...t,
|
|
1097
|
-
children: e ?? /* @__PURE__ */ Z(
|
|
1206
|
+
children: e ?? /* @__PURE__ */ Z(He, { size: 14 })
|
|
1098
1207
|
});
|
|
1099
|
-
},
|
|
1100
|
-
let { goToNext: r, totalBranches: i } =
|
|
1208
|
+
}, Nr = ({ children: e, className: t, ...n }) => {
|
|
1209
|
+
let { goToNext: r, totalBranches: i } = Or();
|
|
1101
1210
|
return /* @__PURE__ */ Z(v, {
|
|
1102
1211
|
"aria-label": "Next branch",
|
|
1103
1212
|
disabled: i <= 1,
|
|
@@ -1106,12 +1215,12 @@ var lr = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Z("div", {
|
|
|
1106
1215
|
type: "button",
|
|
1107
1216
|
variant: "ghost",
|
|
1108
1217
|
...n,
|
|
1109
|
-
children: e ?? /* @__PURE__ */ Z(
|
|
1218
|
+
children: e ?? /* @__PURE__ */ Z(Ue, { size: 14 })
|
|
1110
1219
|
});
|
|
1111
|
-
},
|
|
1112
|
-
let { currentBranch: n, totalBranches: r } =
|
|
1113
|
-
return /* @__PURE__ */ Q(
|
|
1114
|
-
className:
|
|
1220
|
+
}, Pr = ({ className: e, ...t }) => {
|
|
1221
|
+
let { currentBranch: n, totalBranches: r } = Or();
|
|
1222
|
+
return /* @__PURE__ */ Q(Sr, {
|
|
1223
|
+
className: W("border-none bg-transparent text-muted-foreground shadow-none", e),
|
|
1115
1224
|
...t,
|
|
1116
1225
|
children: [
|
|
1117
1226
|
n + 1,
|
|
@@ -1119,15 +1228,15 @@ var lr = ({ className: e, from: t, ...n }) => /* @__PURE__ */ Z("div", {
|
|
|
1119
1228
|
r
|
|
1120
1229
|
]
|
|
1121
1230
|
});
|
|
1122
|
-
},
|
|
1123
|
-
className:
|
|
1231
|
+
}, Fr = a(({ className: e, ...t }) => /* @__PURE__ */ Z(Nt, {
|
|
1232
|
+
className: W("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", e),
|
|
1124
1233
|
...t
|
|
1125
1234
|
}), (e, t) => e.children === t.children);
|
|
1126
|
-
|
|
1127
|
-
function
|
|
1235
|
+
Fr.displayName = "MessageResponse";
|
|
1236
|
+
function Ir({ data: e, className: t, onRemove: n, ...r }) {
|
|
1128
1237
|
let i = e.filename || "", a = (e.mediaType?.startsWith("image/") && e.url ? "image" : "file") == "image", o = i || (a ? "Image" : "Attachment");
|
|
1129
1238
|
return /* @__PURE__ */ Z("div", {
|
|
1130
|
-
className:
|
|
1239
|
+
className: W("group relative size-24 overflow-hidden rounded-lg", t),
|
|
1131
1240
|
...r,
|
|
1132
1241
|
children: a ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("img", {
|
|
1133
1242
|
alt: i || "attachment",
|
|
@@ -1143,17 +1252,17 @@ function Sr({ data: e, className: t, onRemove: n, ...r }) {
|
|
|
1143
1252
|
},
|
|
1144
1253
|
type: "button",
|
|
1145
1254
|
variant: "ghost",
|
|
1146
|
-
children: [/* @__PURE__ */ Z(
|
|
1255
|
+
children: [/* @__PURE__ */ Z(Y, {}), /* @__PURE__ */ Z("span", {
|
|
1147
1256
|
className: "sr-only",
|
|
1148
1257
|
children: "Remove"
|
|
1149
1258
|
})]
|
|
1150
|
-
})] }) : /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Q(
|
|
1259
|
+
})] }) : /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Q(Oe, { children: [/* @__PURE__ */ Z(je, {
|
|
1151
1260
|
asChild: !0,
|
|
1152
1261
|
children: /* @__PURE__ */ Z("div", {
|
|
1153
1262
|
className: "flex size-full shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground",
|
|
1154
|
-
children: /* @__PURE__ */ Z(
|
|
1263
|
+
children: /* @__PURE__ */ Z(ct, { className: "size-4" })
|
|
1155
1264
|
})
|
|
1156
|
-
}), /* @__PURE__ */ Z(
|
|
1265
|
+
}), /* @__PURE__ */ Z(ke, { children: /* @__PURE__ */ Z("p", { children: o }) })] }), n && /* @__PURE__ */ Q(v, {
|
|
1157
1266
|
"aria-label": "Remove attachment",
|
|
1158
1267
|
className: "size-6 shrink-0 rounded-full p-0 opacity-0 transition-opacity hover:bg-accent group-hover:opacity-100 [&>svg]:size-3",
|
|
1159
1268
|
onClick: (e) => {
|
|
@@ -1161,36 +1270,36 @@ function Sr({ data: e, className: t, onRemove: n, ...r }) {
|
|
|
1161
1270
|
},
|
|
1162
1271
|
type: "button",
|
|
1163
1272
|
variant: "ghost",
|
|
1164
|
-
children: [/* @__PURE__ */ Z(
|
|
1273
|
+
children: [/* @__PURE__ */ Z(Y, {}), /* @__PURE__ */ Z("span", {
|
|
1165
1274
|
className: "sr-only",
|
|
1166
1275
|
children: "Remove"
|
|
1167
1276
|
})]
|
|
1168
1277
|
})] })
|
|
1169
1278
|
});
|
|
1170
1279
|
}
|
|
1171
|
-
function
|
|
1280
|
+
function Lr({ children: e, className: t, ...n }) {
|
|
1172
1281
|
return e ? /* @__PURE__ */ Z("div", {
|
|
1173
|
-
className:
|
|
1282
|
+
className: W("ml-auto flex w-fit flex-wrap items-start gap-2", t),
|
|
1174
1283
|
...n,
|
|
1175
1284
|
children: e
|
|
1176
1285
|
}) : null;
|
|
1177
1286
|
}
|
|
1178
|
-
var
|
|
1179
|
-
className:
|
|
1287
|
+
var Rr = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Z("div", {
|
|
1288
|
+
className: W("mt-4 flex w-full items-center justify-between gap-4", e),
|
|
1180
1289
|
...n,
|
|
1181
1290
|
children: t
|
|
1182
1291
|
});
|
|
1183
1292
|
//#endregion
|
|
1184
1293
|
//#region src/elements/ui/input-group.tsx
|
|
1185
|
-
function
|
|
1294
|
+
function zr({ className: e, ...t }) {
|
|
1186
1295
|
return /* @__PURE__ */ Z("div", {
|
|
1187
1296
|
"data-slot": "input-group",
|
|
1188
1297
|
role: "group",
|
|
1189
|
-
className:
|
|
1298
|
+
className: W("group/input-group relative flex w-full items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none dark:bg-input/30", "h-9 min-w-0 has-[>textarea]:h-auto", "has-[>[data-align=inline-start]]:[&>input]:pl-2", "has-[>[data-align=inline-end]]:[&>input]:pr-2", "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3", "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3", "has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50", "has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40", e),
|
|
1190
1299
|
...t
|
|
1191
1300
|
});
|
|
1192
1301
|
}
|
|
1193
|
-
var
|
|
1302
|
+
var Br = jt("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4", {
|
|
1194
1303
|
variants: { align: {
|
|
1195
1304
|
"inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
|
|
1196
1305
|
"inline-end": "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
|
|
@@ -1199,19 +1308,19 @@ var Er = At("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 te
|
|
|
1199
1308
|
} },
|
|
1200
1309
|
defaultVariants: { align: "inline-start" }
|
|
1201
1310
|
});
|
|
1202
|
-
function
|
|
1311
|
+
function Vr({ className: e, align: t = "inline-start", ...n }) {
|
|
1203
1312
|
return /* @__PURE__ */ Z("div", {
|
|
1204
1313
|
role: "group",
|
|
1205
1314
|
"data-slot": "input-group-addon",
|
|
1206
1315
|
"data-align": t,
|
|
1207
|
-
className:
|
|
1316
|
+
className: W(Br({ align: t }), e),
|
|
1208
1317
|
onClick: (e) => {
|
|
1209
1318
|
e.target.closest("button") || e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
1210
1319
|
},
|
|
1211
1320
|
...n
|
|
1212
1321
|
});
|
|
1213
1322
|
}
|
|
1214
|
-
var
|
|
1323
|
+
var Hr = jt("flex items-center gap-2 text-sm shadow-none", {
|
|
1215
1324
|
variants: { size: {
|
|
1216
1325
|
xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",
|
|
1217
1326
|
sm: "h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5",
|
|
@@ -1220,38 +1329,38 @@ var Or = At("flex items-center gap-2 text-sm shadow-none", {
|
|
|
1220
1329
|
} },
|
|
1221
1330
|
defaultVariants: { size: "xs" }
|
|
1222
1331
|
});
|
|
1223
|
-
function
|
|
1332
|
+
function Ur({ className: e, type: t = "button", variant: n = "ghost", size: r = "xs", ...i }) {
|
|
1224
1333
|
return /* @__PURE__ */ Z(v, {
|
|
1225
1334
|
type: t,
|
|
1226
1335
|
"data-size": r,
|
|
1227
1336
|
variant: n,
|
|
1228
|
-
className:
|
|
1337
|
+
className: W(Hr({ size: r }), e),
|
|
1229
1338
|
...i
|
|
1230
1339
|
});
|
|
1231
1340
|
}
|
|
1232
|
-
function
|
|
1233
|
-
return /* @__PURE__ */ Z(
|
|
1341
|
+
function Wr({ className: e, ...t }) {
|
|
1342
|
+
return /* @__PURE__ */ Z(De, {
|
|
1234
1343
|
"data-slot": "input-group-control",
|
|
1235
|
-
className:
|
|
1344
|
+
className: W("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent", e),
|
|
1236
1345
|
...t
|
|
1237
1346
|
});
|
|
1238
1347
|
}
|
|
1239
1348
|
//#endregion
|
|
1240
1349
|
//#region src/elements/prompt-input.tsx
|
|
1241
|
-
var
|
|
1242
|
-
let e = s(
|
|
1350
|
+
var Gr = r(null), Kr = r(null), qr = () => {
|
|
1351
|
+
let e = s(Gr);
|
|
1243
1352
|
if (!e) throw Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");
|
|
1244
1353
|
return e;
|
|
1245
|
-
},
|
|
1246
|
-
let e = s(
|
|
1354
|
+
}, Jr = () => s(Gr), Yr = () => {
|
|
1355
|
+
let e = s(Kr);
|
|
1247
1356
|
if (!e) throw Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");
|
|
1248
1357
|
return e;
|
|
1249
|
-
},
|
|
1250
|
-
function
|
|
1358
|
+
}, Xr = () => s(Kr);
|
|
1359
|
+
function Zr({ initialInput: e = "", children: t }) {
|
|
1251
1360
|
let [n, r] = d(e), i = o(() => r(""), []), [a, s] = d([]), f = u(null), p = u(() => {}), m = o((e) => {
|
|
1252
1361
|
let t = Array.from(e);
|
|
1253
1362
|
t.length !== 0 && s((e) => e.concat(t.map((e) => ({
|
|
1254
|
-
id:
|
|
1363
|
+
id: Pt(),
|
|
1255
1364
|
type: "file",
|
|
1256
1365
|
url: URL.createObjectURL(e),
|
|
1257
1366
|
mediaType: e.type,
|
|
@@ -1303,25 +1412,25 @@ function Lr({ initialInput: e = "", children: t }) {
|
|
|
1303
1412
|
y,
|
|
1304
1413
|
b
|
|
1305
1414
|
]);
|
|
1306
|
-
return /* @__PURE__ */ Z(
|
|
1415
|
+
return /* @__PURE__ */ Z(Gr.Provider, {
|
|
1307
1416
|
value: x,
|
|
1308
|
-
children: /* @__PURE__ */ Z(
|
|
1417
|
+
children: /* @__PURE__ */ Z(Kr.Provider, {
|
|
1309
1418
|
value: y,
|
|
1310
1419
|
children: t
|
|
1311
1420
|
})
|
|
1312
1421
|
});
|
|
1313
1422
|
}
|
|
1314
|
-
var
|
|
1315
|
-
let e =
|
|
1423
|
+
var Qr = r(null), $r = () => {
|
|
1424
|
+
let e = Xr(), t = s(Qr), n = e ?? t;
|
|
1316
1425
|
if (!n) throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");
|
|
1317
1426
|
return n;
|
|
1318
1427
|
};
|
|
1319
|
-
function
|
|
1320
|
-
let r =
|
|
1321
|
-
return /* @__PURE__ */ Q(
|
|
1428
|
+
function ei({ data: e, className: t, ...n }) {
|
|
1429
|
+
let r = $r(), i = e.filename || "", a = (e.mediaType?.startsWith("image/") && e.url ? "image" : "file") == "image", o = i || (a ? "Image" : "Attachment");
|
|
1430
|
+
return /* @__PURE__ */ Q(xi, { children: [/* @__PURE__ */ Z(oe, {
|
|
1322
1431
|
asChild: !0,
|
|
1323
1432
|
children: /* @__PURE__ */ Q("div", {
|
|
1324
|
-
className:
|
|
1433
|
+
className: W("group relative flex h-8 cursor-pointer select-none items-center gap-1.5 rounded-md border border-border px-1.5 font-medium text-sm transition-all hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50", t),
|
|
1325
1434
|
...n,
|
|
1326
1435
|
children: [/* @__PURE__ */ Q("div", {
|
|
1327
1436
|
className: "relative size-5 shrink-0",
|
|
@@ -1335,7 +1444,7 @@ function Br({ data: e, className: t, ...n }) {
|
|
|
1335
1444
|
width: 20
|
|
1336
1445
|
}) : /* @__PURE__ */ Z("div", {
|
|
1337
1446
|
className: "flex size-5 items-center justify-center text-muted-foreground",
|
|
1338
|
-
children: /* @__PURE__ */ Z(
|
|
1447
|
+
children: /* @__PURE__ */ Z(ct, { className: "size-3" })
|
|
1339
1448
|
})
|
|
1340
1449
|
}), /* @__PURE__ */ Q(v, {
|
|
1341
1450
|
"aria-label": "Remove attachment",
|
|
@@ -1345,7 +1454,7 @@ function Br({ data: e, className: t, ...n }) {
|
|
|
1345
1454
|
},
|
|
1346
1455
|
type: "button",
|
|
1347
1456
|
variant: "ghost",
|
|
1348
|
-
children: [/* @__PURE__ */ Z(
|
|
1457
|
+
children: [/* @__PURE__ */ Z(Y, {}), /* @__PURE__ */ Z("span", {
|
|
1349
1458
|
className: "sr-only",
|
|
1350
1459
|
children: "Remove"
|
|
1351
1460
|
})]
|
|
@@ -1355,7 +1464,7 @@ function Br({ data: e, className: t, ...n }) {
|
|
|
1355
1464
|
children: o
|
|
1356
1465
|
})]
|
|
1357
1466
|
}, e.id)
|
|
1358
|
-
}), /* @__PURE__ */ Z(
|
|
1467
|
+
}), /* @__PURE__ */ Z(Ci, {
|
|
1359
1468
|
className: "w-auto p-2",
|
|
1360
1469
|
children: /* @__PURE__ */ Q("div", {
|
|
1361
1470
|
className: "w-auto space-y-3",
|
|
@@ -1384,29 +1493,29 @@ function Br({ data: e, className: t, ...n }) {
|
|
|
1384
1493
|
})
|
|
1385
1494
|
})] });
|
|
1386
1495
|
}
|
|
1387
|
-
function
|
|
1388
|
-
let i =
|
|
1496
|
+
function ti({ children: e, className: t, ...r }) {
|
|
1497
|
+
let i = $r();
|
|
1389
1498
|
return i.files.length ? /* @__PURE__ */ Z("div", {
|
|
1390
|
-
className:
|
|
1499
|
+
className: W("flex flex-wrap items-center gap-2 p-3 w-full", t),
|
|
1391
1500
|
...r,
|
|
1392
1501
|
children: i.files.map((t) => /* @__PURE__ */ Z(n, { children: e(t) }, t.id))
|
|
1393
1502
|
}) : null;
|
|
1394
1503
|
}
|
|
1395
|
-
var
|
|
1396
|
-
let n =
|
|
1504
|
+
var ni = ({ label: e = "Add photos or files", ...t }) => {
|
|
1505
|
+
let n = $r();
|
|
1397
1506
|
return /* @__PURE__ */ Q(F, {
|
|
1398
1507
|
...t,
|
|
1399
1508
|
onSelect: (e) => {
|
|
1400
1509
|
e.preventDefault(), n.openFileDialog();
|
|
1401
1510
|
},
|
|
1402
1511
|
children: [
|
|
1403
|
-
/* @__PURE__ */ Z(
|
|
1512
|
+
/* @__PURE__ */ Z(nt, { className: "mr-2 size-4" }),
|
|
1404
1513
|
" ",
|
|
1405
1514
|
e
|
|
1406
1515
|
]
|
|
1407
1516
|
});
|
|
1408
|
-
},
|
|
1409
|
-
let _ =
|
|
1517
|
+
}, ri = ({ className: e, accept: t, multiple: n, fileInputLabel: r = "Upload files", globalDrop: i, syncHiddenInput: a, maxFiles: s, maxFileSize: f, onError: p, onSubmit: m, children: h, ...g }) => {
|
|
1518
|
+
let _ = Jr(), v = !!_, y = u(null), b = u(null), [x, S] = d([]), C = v ? _.attachments.files : x, w = u(C);
|
|
1410
1519
|
w.current = C;
|
|
1411
1520
|
let T = o(() => {
|
|
1412
1521
|
y.current?.click();
|
|
@@ -1441,7 +1550,7 @@ var Hr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1441
1550
|
});
|
|
1442
1551
|
let i = [];
|
|
1443
1552
|
for (let e of n) i.push({
|
|
1444
|
-
id:
|
|
1553
|
+
id: Pt(),
|
|
1445
1554
|
type: "file",
|
|
1446
1555
|
url: URL.createObjectURL(e),
|
|
1447
1556
|
mediaType: e.type,
|
|
@@ -1528,7 +1637,7 @@ var Hr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1528
1637
|
title: r,
|
|
1529
1638
|
type: "file"
|
|
1530
1639
|
}), /* @__PURE__ */ Z("form", {
|
|
1531
|
-
className:
|
|
1640
|
+
className: W("w-full", e),
|
|
1532
1641
|
onSubmit: (e) => {
|
|
1533
1642
|
e.preventDefault();
|
|
1534
1643
|
let t = e.currentTarget, n = v ? _.textInput.value : new FormData(t).get("message") || "";
|
|
@@ -1555,20 +1664,20 @@ var Hr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1555
1664
|
},
|
|
1556
1665
|
ref: b,
|
|
1557
1666
|
...g,
|
|
1558
|
-
children: /* @__PURE__ */ Z(
|
|
1667
|
+
children: /* @__PURE__ */ Z(zr, {
|
|
1559
1668
|
className: "overflow-hidden",
|
|
1560
1669
|
children: h
|
|
1561
1670
|
})
|
|
1562
1671
|
})] });
|
|
1563
|
-
return v ? I : /* @__PURE__ */ Z(
|
|
1672
|
+
return v ? I : /* @__PURE__ */ Z(Qr.Provider, {
|
|
1564
1673
|
value: F,
|
|
1565
1674
|
children: I
|
|
1566
1675
|
});
|
|
1567
|
-
},
|
|
1568
|
-
className:
|
|
1676
|
+
}, ii = ({ className: e, ...t }) => /* @__PURE__ */ Z("div", {
|
|
1677
|
+
className: W("contents", e),
|
|
1569
1678
|
...t
|
|
1570
|
-
}),
|
|
1571
|
-
let i =
|
|
1679
|
+
}), ai = ({ onChange: e, className: t, placeholder: n = "What would you like to know?", ...r }) => {
|
|
1680
|
+
let i = Jr(), a = $r(), [o, s] = d(!1), c = (e) => {
|
|
1572
1681
|
if (e.key === "Enter") {
|
|
1573
1682
|
if (o || e.nativeEvent.isComposing || e.shiftKey) return;
|
|
1574
1683
|
e.preventDefault();
|
|
@@ -1596,8 +1705,8 @@ var Hr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1596
1705
|
i.textInput.setInput(t.currentTarget.value), e?.(t);
|
|
1597
1706
|
}
|
|
1598
1707
|
} : { onChange: e };
|
|
1599
|
-
return /* @__PURE__ */ Z(
|
|
1600
|
-
className:
|
|
1708
|
+
return /* @__PURE__ */ Z(Wr, {
|
|
1709
|
+
className: W("field-sizing-content max-h-48 min-h-16", t),
|
|
1601
1710
|
name: "message",
|
|
1602
1711
|
onCompositionEnd: () => s(!1),
|
|
1603
1712
|
onCompositionStart: () => s(!0),
|
|
@@ -1607,52 +1716,52 @@ var Hr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1607
1716
|
...r,
|
|
1608
1717
|
...u
|
|
1609
1718
|
});
|
|
1610
|
-
},
|
|
1719
|
+
}, oi = ({ className: e, ...t }) => /* @__PURE__ */ Z(Vr, {
|
|
1611
1720
|
align: "block-end",
|
|
1612
|
-
className:
|
|
1721
|
+
className: W("order-first flex-wrap gap-1", e),
|
|
1613
1722
|
...t
|
|
1614
|
-
}),
|
|
1723
|
+
}), si = ({ className: e, ...t }) => /* @__PURE__ */ Z(Vr, {
|
|
1615
1724
|
align: "block-end",
|
|
1616
|
-
className:
|
|
1725
|
+
className: W("justify-between gap-1", e),
|
|
1617
1726
|
...t
|
|
1618
|
-
}),
|
|
1619
|
-
className:
|
|
1727
|
+
}), ci = ({ className: e, ...t }) => /* @__PURE__ */ Z("div", {
|
|
1728
|
+
className: W("flex items-center gap-1", e),
|
|
1620
1729
|
...t
|
|
1621
|
-
}),
|
|
1730
|
+
}), li = ({ variant: e = "ghost", className: n, size: r, ...i }) => {
|
|
1622
1731
|
let a = r ?? (t.count(i.children) > 1 ? "sm" : "icon-sm");
|
|
1623
|
-
return /* @__PURE__ */ Z(
|
|
1624
|
-
className:
|
|
1732
|
+
return /* @__PURE__ */ Z(Ur, {
|
|
1733
|
+
className: W(n),
|
|
1625
1734
|
size: a,
|
|
1626
1735
|
type: "button",
|
|
1627
1736
|
variant: e,
|
|
1628
1737
|
...i
|
|
1629
1738
|
});
|
|
1630
|
-
},
|
|
1739
|
+
}, ui = (e) => /* @__PURE__ */ Z(ee, { ...e }), di = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Z(I, {
|
|
1631
1740
|
asChild: !0,
|
|
1632
|
-
children: /* @__PURE__ */ Z(
|
|
1741
|
+
children: /* @__PURE__ */ Z(li, {
|
|
1633
1742
|
className: e,
|
|
1634
1743
|
...n,
|
|
1635
|
-
children: t ?? /* @__PURE__ */ Z(
|
|
1744
|
+
children: t ?? /* @__PURE__ */ Z(lt, { className: "size-4" })
|
|
1636
1745
|
})
|
|
1637
|
-
}),
|
|
1746
|
+
}), fi = ({ className: e, ...t }) => /* @__PURE__ */ Z(P, {
|
|
1638
1747
|
align: "start",
|
|
1639
|
-
className:
|
|
1748
|
+
className: W(e),
|
|
1640
1749
|
...t
|
|
1641
|
-
}),
|
|
1642
|
-
className:
|
|
1750
|
+
}), pi = ({ className: e, ...t }) => /* @__PURE__ */ Z(F, {
|
|
1751
|
+
className: W(e),
|
|
1643
1752
|
...t
|
|
1644
|
-
}),
|
|
1645
|
-
let o = /* @__PURE__ */ Z(
|
|
1646
|
-
return r === "submitted" ? o = /* @__PURE__ */ Z(
|
|
1753
|
+
}), mi = ({ className: e, variant: t = "default", size: n = "icon-sm", status: r, children: i, ...a }) => {
|
|
1754
|
+
let o = /* @__PURE__ */ Z(Ze, { className: "size-4" });
|
|
1755
|
+
return r === "submitted" ? o = /* @__PURE__ */ Z(at, { className: "size-4 animate-spin" }) : r === "streaming" ? o = /* @__PURE__ */ Z(ht, { className: "size-4" }) : r === "error" && (o = /* @__PURE__ */ Z(Y, { className: "size-4" })), /* @__PURE__ */ Z(Ur, {
|
|
1647
1756
|
"aria-label": "Submit",
|
|
1648
|
-
className:
|
|
1757
|
+
className: W(e),
|
|
1649
1758
|
size: n,
|
|
1650
1759
|
type: "submit",
|
|
1651
1760
|
variant: t,
|
|
1652
1761
|
...a,
|
|
1653
1762
|
children: i ?? o
|
|
1654
1763
|
});
|
|
1655
|
-
},
|
|
1764
|
+
}, hi = ({ className: e, textareaRef: t, onTranscriptionChange: n, ...r }) => {
|
|
1656
1765
|
let [i, a] = d(!1), [s, l] = d(null), f = u(null);
|
|
1657
1766
|
c(() => {
|
|
1658
1767
|
if (typeof window < "u" && ("SpeechRecognition" in window || "webkitSpeechRecognition" in window)) {
|
|
@@ -1682,80 +1791,80 @@ var Hr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1682
1791
|
let p = o(() => {
|
|
1683
1792
|
s && (i ? s.stop() : s.start());
|
|
1684
1793
|
}, [s, i]);
|
|
1685
|
-
return /* @__PURE__ */ Z(
|
|
1686
|
-
className:
|
|
1794
|
+
return /* @__PURE__ */ Z(li, {
|
|
1795
|
+
className: W("relative transition-all duration-200", i && "animate-pulse bg-accent text-accent-foreground", e),
|
|
1687
1796
|
disabled: !s,
|
|
1688
1797
|
onClick: p,
|
|
1689
1798
|
...r,
|
|
1690
|
-
children: /* @__PURE__ */ Z(
|
|
1799
|
+
children: /* @__PURE__ */ Z(st, { className: "size-4" })
|
|
1691
1800
|
});
|
|
1692
|
-
},
|
|
1693
|
-
className:
|
|
1801
|
+
}, gi = (e) => /* @__PURE__ */ Z(ce, { ...e }), _i = ({ className: e, ...t }) => /* @__PURE__ */ Z(de, {
|
|
1802
|
+
className: W("border-none bg-transparent font-medium text-muted-foreground shadow-none transition-colors", "hover:bg-accent hover:text-foreground aria-expanded:bg-accent aria-expanded:text-foreground", e),
|
|
1694
1803
|
...t
|
|
1695
|
-
}),
|
|
1696
|
-
className:
|
|
1804
|
+
}), vi = ({ className: e, ...t }) => /* @__PURE__ */ Z(le, {
|
|
1805
|
+
className: W(e),
|
|
1697
1806
|
...t
|
|
1698
|
-
}),
|
|
1699
|
-
className:
|
|
1807
|
+
}), yi = ({ className: e, ...t }) => /* @__PURE__ */ Z(ue, {
|
|
1808
|
+
className: W(e),
|
|
1700
1809
|
...t
|
|
1701
|
-
}),
|
|
1702
|
-
className:
|
|
1810
|
+
}), bi = ({ className: e, ...t }) => /* @__PURE__ */ Z(fe, {
|
|
1811
|
+
className: W(e),
|
|
1703
1812
|
...t
|
|
1704
|
-
}),
|
|
1813
|
+
}), xi = ({ openDelay: e = 0, closeDelay: t = 0, ...n }) => /* @__PURE__ */ Z(R, {
|
|
1705
1814
|
closeDelay: t,
|
|
1706
1815
|
openDelay: e,
|
|
1707
1816
|
...n
|
|
1708
|
-
}),
|
|
1817
|
+
}), Si = (e) => /* @__PURE__ */ Z(oe, { ...e }), Ci = ({ align: e = "start", ...t }) => /* @__PURE__ */ Z(ae, {
|
|
1709
1818
|
align: e,
|
|
1710
1819
|
...t
|
|
1711
|
-
}),
|
|
1712
|
-
className:
|
|
1820
|
+
}), wi = ({ className: e, ...t }) => /* @__PURE__ */ Z("div", {
|
|
1821
|
+
className: W(e),
|
|
1713
1822
|
...t
|
|
1714
|
-
}),
|
|
1715
|
-
className:
|
|
1823
|
+
}), Ti = ({ className: e, ...t }) => /* @__PURE__ */ Z("div", {
|
|
1824
|
+
className: W(e),
|
|
1716
1825
|
...t
|
|
1717
|
-
}),
|
|
1718
|
-
className:
|
|
1826
|
+
}), Ei = ({ className: e, ...t }) => /* @__PURE__ */ Z("h3", {
|
|
1827
|
+
className: W("mb-2 px-3 font-medium text-muted-foreground text-xs", e),
|
|
1719
1828
|
...t
|
|
1720
|
-
}),
|
|
1721
|
-
className:
|
|
1829
|
+
}), Di = ({ className: e, ...t }) => /* @__PURE__ */ Z("div", {
|
|
1830
|
+
className: W("space-y-1", e),
|
|
1722
1831
|
...t
|
|
1723
|
-
}),
|
|
1724
|
-
className:
|
|
1832
|
+
}), Oi = ({ className: e, ...t }) => /* @__PURE__ */ Z("div", {
|
|
1833
|
+
className: W("flex items-center gap-2 px-3 py-2 text-xs hover:bg-accent", e),
|
|
1725
1834
|
...t
|
|
1726
|
-
}),
|
|
1727
|
-
className:
|
|
1835
|
+
}), ki = ({ className: e, ...t }) => /* @__PURE__ */ Z(D, {
|
|
1836
|
+
className: W(e),
|
|
1728
1837
|
...t
|
|
1729
|
-
}),
|
|
1730
|
-
className:
|
|
1838
|
+
}), Ai = ({ className: e, ...t }) => /* @__PURE__ */ Z(A, {
|
|
1839
|
+
className: W(e),
|
|
1731
1840
|
...t
|
|
1732
|
-
}),
|
|
1733
|
-
className:
|
|
1841
|
+
}), ji = ({ className: e, ...t }) => /* @__PURE__ */ Z(M, {
|
|
1842
|
+
className: W(e),
|
|
1734
1843
|
...t
|
|
1735
|
-
}),
|
|
1736
|
-
className:
|
|
1844
|
+
}), Mi = ({ className: e, ...t }) => /* @__PURE__ */ Z(O, {
|
|
1845
|
+
className: W(e),
|
|
1737
1846
|
...t
|
|
1738
|
-
}),
|
|
1739
|
-
className:
|
|
1847
|
+
}), Ni = ({ className: e, ...t }) => /* @__PURE__ */ Z(k, {
|
|
1848
|
+
className: W(e),
|
|
1740
1849
|
...t
|
|
1741
|
-
}),
|
|
1742
|
-
className:
|
|
1850
|
+
}), Pi = ({ className: e, ...t }) => /* @__PURE__ */ Z(j, {
|
|
1851
|
+
className: W(e),
|
|
1743
1852
|
...t
|
|
1744
|
-
}),
|
|
1745
|
-
className:
|
|
1853
|
+
}), Fi = ({ className: e, ...t }) => /* @__PURE__ */ Z(N, {
|
|
1854
|
+
className: W(e),
|
|
1746
1855
|
...t
|
|
1747
|
-
}),
|
|
1856
|
+
}), Ii = ({ className: e, children: t, ...n }) => /* @__PURE__ */ Q(se, {
|
|
1748
1857
|
className: "w-full overflow-x-auto whitespace-nowrap",
|
|
1749
1858
|
...n,
|
|
1750
1859
|
children: [/* @__PURE__ */ Z("div", {
|
|
1751
|
-
className:
|
|
1860
|
+
className: W("flex w-max flex-nowrap items-center gap-2", e),
|
|
1752
1861
|
children: t
|
|
1753
|
-
}), /* @__PURE__ */ Z(
|
|
1862
|
+
}), /* @__PURE__ */ Z(V, {
|
|
1754
1863
|
className: "hidden",
|
|
1755
1864
|
orientation: "horizontal"
|
|
1756
1865
|
})]
|
|
1757
|
-
}),
|
|
1758
|
-
className:
|
|
1866
|
+
}), Li = ({ suggestion: e, onClick: t, className: n, variant: r = "outline", size: i = "sm", children: a, ...o }) => /* @__PURE__ */ Z(v, {
|
|
1867
|
+
className: W("cursor-pointer rounded-full px-4", n),
|
|
1759
1868
|
onClick: () => {
|
|
1760
1869
|
t?.(e);
|
|
1761
1870
|
},
|
|
@@ -1764,7 +1873,7 @@ var Hr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1764
1873
|
variant: r,
|
|
1765
1874
|
...o,
|
|
1766
1875
|
children: a || e
|
|
1767
|
-
}),
|
|
1876
|
+
}), Ri = r({ code: "" }), zi = {
|
|
1768
1877
|
name: "line-numbers",
|
|
1769
1878
|
line(e, t) {
|
|
1770
1879
|
e.children.unshift({
|
|
@@ -1785,21 +1894,21 @@ var Hr = ({ label: e = "Add photos or files", ...t }) => {
|
|
|
1785
1894
|
});
|
|
1786
1895
|
}
|
|
1787
1896
|
};
|
|
1788
|
-
async function
|
|
1789
|
-
let r = n ? [
|
|
1790
|
-
return await Promise.all([
|
|
1897
|
+
async function Bi(e, t, n = !1) {
|
|
1898
|
+
let r = n ? [zi] : [];
|
|
1899
|
+
return await Promise.all([Ft(e, {
|
|
1791
1900
|
lang: t,
|
|
1792
1901
|
theme: "one-light",
|
|
1793
1902
|
transformers: r
|
|
1794
|
-
}),
|
|
1903
|
+
}), Ft(e, {
|
|
1795
1904
|
lang: t,
|
|
1796
1905
|
theme: "one-dark-pro",
|
|
1797
1906
|
transformers: r
|
|
1798
1907
|
})]);
|
|
1799
1908
|
}
|
|
1800
|
-
var
|
|
1909
|
+
var Vi = ({ code: e, language: t, showLineNumbers: n = !1, className: r, children: i, ...a }) => {
|
|
1801
1910
|
let [o, s] = d(""), [l, f] = d(""), p = u(!1);
|
|
1802
|
-
return c(() => (
|
|
1911
|
+
return c(() => (Bi(e, t, n).then(([e, t]) => {
|
|
1803
1912
|
p.current ||= (s(e), f(t), !0);
|
|
1804
1913
|
}), () => {
|
|
1805
1914
|
p.current = !1;
|
|
@@ -1807,10 +1916,10 @@ var Di = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1807
1916
|
e,
|
|
1808
1917
|
t,
|
|
1809
1918
|
n
|
|
1810
|
-
]), /* @__PURE__ */ Z(
|
|
1919
|
+
]), /* @__PURE__ */ Z(Ri.Provider, {
|
|
1811
1920
|
value: { code: e },
|
|
1812
1921
|
children: /* @__PURE__ */ Z("div", {
|
|
1813
|
-
className:
|
|
1922
|
+
className: W("group relative w-full overflow-hidden rounded-md border bg-background text-foreground", r),
|
|
1814
1923
|
...a,
|
|
1815
1924
|
children: /* @__PURE__ */ Q("div", {
|
|
1816
1925
|
className: "relative",
|
|
@@ -1831,8 +1940,8 @@ var Di = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1831
1940
|
})
|
|
1832
1941
|
})
|
|
1833
1942
|
});
|
|
1834
|
-
},
|
|
1835
|
-
let [o, c] = d(!1), { code: l } = s(
|
|
1943
|
+
}, Hi = ({ onCopy: e, onError: t, timeout: n = 2e3, children: r, className: i, ...a }) => {
|
|
1944
|
+
let [o, c] = d(!1), { code: l } = s(Ri), u = async () => {
|
|
1836
1945
|
if (typeof window > "u" || !navigator?.clipboard?.writeText) {
|
|
1837
1946
|
t?.(/* @__PURE__ */ Error("Clipboard API not available"));
|
|
1838
1947
|
return;
|
|
@@ -1842,29 +1951,29 @@ var Di = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1842
1951
|
} catch (e) {
|
|
1843
1952
|
t?.(e);
|
|
1844
1953
|
}
|
|
1845
|
-
}, f = o ?
|
|
1954
|
+
}, f = o ? Be : Ye;
|
|
1846
1955
|
return /* @__PURE__ */ Z(v, {
|
|
1847
|
-
className:
|
|
1956
|
+
className: W("shrink-0", i),
|
|
1848
1957
|
onClick: u,
|
|
1849
1958
|
size: "icon",
|
|
1850
1959
|
variant: "ghost",
|
|
1851
1960
|
...a,
|
|
1852
1961
|
children: r ?? /* @__PURE__ */ Z(f, { size: 14 })
|
|
1853
1962
|
});
|
|
1854
|
-
},
|
|
1855
|
-
className:
|
|
1963
|
+
}, Ui = ({ className: e, ...t }) => /* @__PURE__ */ Z(w, {
|
|
1964
|
+
className: W("not-prose mb-4 w-full rounded-md border", e),
|
|
1856
1965
|
...t
|
|
1857
|
-
}),
|
|
1966
|
+
}), Wi = (e) => /* @__PURE__ */ Q(_, {
|
|
1858
1967
|
className: "gap-1.5 rounded-full text-xs",
|
|
1859
1968
|
variant: "secondary",
|
|
1860
1969
|
children: [{
|
|
1861
|
-
"input-streaming": /* @__PURE__ */ Z(
|
|
1862
|
-
"input-available": /* @__PURE__ */ Z(
|
|
1863
|
-
"approval-requested": /* @__PURE__ */ Z(
|
|
1864
|
-
"approval-responded": /* @__PURE__ */ Z(
|
|
1865
|
-
"output-available": /* @__PURE__ */ Z(
|
|
1866
|
-
"output-error": /* @__PURE__ */ Z(
|
|
1867
|
-
"output-denied": /* @__PURE__ */ Z(
|
|
1970
|
+
"input-streaming": /* @__PURE__ */ Z(K, { className: "size-4" }),
|
|
1971
|
+
"input-available": /* @__PURE__ */ Z(qe, { className: "size-4 animate-pulse" }),
|
|
1972
|
+
"approval-requested": /* @__PURE__ */ Z(qe, { className: "size-4 text-yellow-600" }),
|
|
1973
|
+
"approval-responded": /* @__PURE__ */ Z(ze, { className: "size-4 text-blue-600" }),
|
|
1974
|
+
"output-available": /* @__PURE__ */ Z(ze, { className: "size-4 text-green-600" }),
|
|
1975
|
+
"output-error": /* @__PURE__ */ Z(xt, { className: "size-4 text-red-600" }),
|
|
1976
|
+
"output-denied": /* @__PURE__ */ Z(xt, { className: "size-4 text-orange-600" })
|
|
1868
1977
|
}[e], {
|
|
1869
1978
|
"input-streaming": "Pending",
|
|
1870
1979
|
"input-available": "Running",
|
|
@@ -1874,61 +1983,61 @@ var Di = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1874
1983
|
"output-error": "Error",
|
|
1875
1984
|
"output-denied": "Denied"
|
|
1876
1985
|
}[e]]
|
|
1877
|
-
}),
|
|
1878
|
-
className:
|
|
1986
|
+
}), Gi = ({ className: e, title: t, type: n, state: r, ...i }) => /* @__PURE__ */ Q(E, {
|
|
1987
|
+
className: W("flex w-full items-center justify-between gap-4 p-3", e),
|
|
1879
1988
|
...i,
|
|
1880
1989
|
children: [/* @__PURE__ */ Q("div", {
|
|
1881
1990
|
className: "flex items-center gap-2",
|
|
1882
1991
|
children: [
|
|
1883
|
-
/* @__PURE__ */ Z(
|
|
1992
|
+
/* @__PURE__ */ Z(yt, { className: "size-4 text-muted-foreground" }),
|
|
1884
1993
|
/* @__PURE__ */ Z("span", {
|
|
1885
1994
|
className: "font-medium text-sm",
|
|
1886
1995
|
children: t ?? n.split("-").slice(1).join("-")
|
|
1887
1996
|
}),
|
|
1888
|
-
|
|
1997
|
+
Wi(r)
|
|
1889
1998
|
]
|
|
1890
|
-
}), /* @__PURE__ */ Z(
|
|
1891
|
-
}),
|
|
1892
|
-
className:
|
|
1999
|
+
}), /* @__PURE__ */ Z(Ve, { className: "size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" })]
|
|
2000
|
+
}), Ki = ({ className: e, ...t }) => /* @__PURE__ */ Z(T, {
|
|
2001
|
+
className: W("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", e),
|
|
1893
2002
|
...t
|
|
1894
|
-
}),
|
|
1895
|
-
className:
|
|
2003
|
+
}), qi = ({ className: e, input: t, ...n }) => /* @__PURE__ */ Q("div", {
|
|
2004
|
+
className: W("space-y-2 overflow-hidden p-4", e),
|
|
1896
2005
|
...n,
|
|
1897
2006
|
children: [/* @__PURE__ */ Z("h4", {
|
|
1898
2007
|
className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
|
|
1899
2008
|
children: "Parameters"
|
|
1900
2009
|
}), /* @__PURE__ */ Z("div", {
|
|
1901
2010
|
className: "rounded-md bg-muted/50",
|
|
1902
|
-
children: /* @__PURE__ */ Z(
|
|
2011
|
+
children: /* @__PURE__ */ Z(Vi, {
|
|
1903
2012
|
code: JSON.stringify(t, null, 2),
|
|
1904
2013
|
language: "json"
|
|
1905
2014
|
})
|
|
1906
2015
|
})]
|
|
1907
|
-
}),
|
|
2016
|
+
}), Ji = ({ className: e, output: t, errorText: n, ...r }) => {
|
|
1908
2017
|
if (!(t || n)) return null;
|
|
1909
2018
|
let a = /* @__PURE__ */ Z("div", { children: t });
|
|
1910
|
-
return typeof t == "object" && !i(t) ? a = /* @__PURE__ */ Z(
|
|
2019
|
+
return typeof t == "object" && !i(t) ? a = /* @__PURE__ */ Z(Vi, {
|
|
1911
2020
|
code: JSON.stringify(t, null, 2),
|
|
1912
2021
|
language: "json"
|
|
1913
|
-
}) : typeof t == "string" && (a = /* @__PURE__ */ Z(
|
|
2022
|
+
}) : typeof t == "string" && (a = /* @__PURE__ */ Z(Vi, {
|
|
1914
2023
|
code: t,
|
|
1915
2024
|
language: "json"
|
|
1916
2025
|
})), /* @__PURE__ */ Q("div", {
|
|
1917
|
-
className:
|
|
2026
|
+
className: W("space-y-2 p-4", e),
|
|
1918
2027
|
...r,
|
|
1919
2028
|
children: [/* @__PURE__ */ Z("h4", {
|
|
1920
2029
|
className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
|
|
1921
2030
|
children: n ? "Error" : "Result"
|
|
1922
2031
|
}), /* @__PURE__ */ Q("div", {
|
|
1923
|
-
className:
|
|
2032
|
+
className: W("overflow-x-auto rounded-md text-xs [&_table]:w-full", n ? "bg-destructive/10 text-destructive" : "bg-muted/50 text-foreground"),
|
|
1924
2033
|
children: [n && /* @__PURE__ */ Z("div", { children: n }), a]
|
|
1925
2034
|
})]
|
|
1926
2035
|
});
|
|
1927
|
-
},
|
|
1928
|
-
let a = l(() =>
|
|
2036
|
+
}, Yi = a(({ children: e, as: t = "p", className: n, duration: r = 2, spread: i = 2 }) => {
|
|
2037
|
+
let a = l(() => Lt.create(t), [t]), o = l(() => (e?.length ?? 0) * i, [e, i]);
|
|
1929
2038
|
return /* @__PURE__ */ Z(a, {
|
|
1930
2039
|
animate: { backgroundPosition: "0% center" },
|
|
1931
|
-
className:
|
|
2040
|
+
className: W("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent", "[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]", n),
|
|
1932
2041
|
initial: { backgroundPosition: "100% center" },
|
|
1933
2042
|
style: {
|
|
1934
2043
|
"--spread": `${o}px`,
|
|
@@ -1941,21 +2050,21 @@ var Di = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1941
2050
|
},
|
|
1942
2051
|
children: e
|
|
1943
2052
|
});
|
|
1944
|
-
}),
|
|
1945
|
-
let e = s(
|
|
2053
|
+
}), Xi = r(null), Zi = () => {
|
|
2054
|
+
let e = s(Xi);
|
|
1946
2055
|
if (!e) throw Error("Reasoning components must be used within Reasoning");
|
|
1947
2056
|
return e;
|
|
1948
|
-
},
|
|
1949
|
-
let [l, u] =
|
|
2057
|
+
}, Qi = 1e3, $i = 1e3, ea = a(({ className: e, isStreaming: t = !1, open: n, defaultOpen: r = !0, onOpenChange: i, duration: a, children: o, ...s }) => {
|
|
2058
|
+
let [l, u] = It({
|
|
1950
2059
|
prop: n,
|
|
1951
2060
|
defaultProp: r,
|
|
1952
2061
|
onChange: i
|
|
1953
|
-
}), [f, p] =
|
|
2062
|
+
}), [f, p] = It({
|
|
1954
2063
|
prop: a,
|
|
1955
2064
|
defaultProp: void 0
|
|
1956
2065
|
}), [m, h] = d(!1), [g, _] = d(null);
|
|
1957
2066
|
return c(() => {
|
|
1958
|
-
t ? g === null && _(Date.now()) : g !== null && (p(Math.ceil((Date.now() - g) /
|
|
2067
|
+
t ? g === null && _(Date.now()) : g !== null && (p(Math.ceil((Date.now() - g) / $i)), _(null));
|
|
1959
2068
|
}, [
|
|
1960
2069
|
t,
|
|
1961
2070
|
g,
|
|
@@ -1964,7 +2073,7 @@ var Di = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1964
2073
|
if (r && !t && l && !m) {
|
|
1965
2074
|
let e = setTimeout(() => {
|
|
1966
2075
|
u(!1), h(!0);
|
|
1967
|
-
},
|
|
2076
|
+
}, Qi);
|
|
1968
2077
|
return () => clearTimeout(e);
|
|
1969
2078
|
}
|
|
1970
2079
|
}, [
|
|
@@ -1973,7 +2082,7 @@ var Di = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1973
2082
|
r,
|
|
1974
2083
|
u,
|
|
1975
2084
|
m
|
|
1976
|
-
]), /* @__PURE__ */ Z(
|
|
2085
|
+
]), /* @__PURE__ */ Z(Xi.Provider, {
|
|
1977
2086
|
value: {
|
|
1978
2087
|
isStreaming: t,
|
|
1979
2088
|
isOpen: l,
|
|
@@ -1981,7 +2090,7 @@ var Di = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1981
2090
|
duration: f
|
|
1982
2091
|
},
|
|
1983
2092
|
children: /* @__PURE__ */ Z(w, {
|
|
1984
|
-
className:
|
|
2093
|
+
className: W("not-prose mb-4", e),
|
|
1985
2094
|
onOpenChange: (e) => {
|
|
1986
2095
|
u(e);
|
|
1987
2096
|
},
|
|
@@ -1990,37 +2099,37 @@ var Di = ({ code: e, language: t, showLineNumbers: n = !1, className: r, childre
|
|
|
1990
2099
|
children: o
|
|
1991
2100
|
})
|
|
1992
2101
|
});
|
|
1993
|
-
}),
|
|
2102
|
+
}), ta = (e, t) => e || t === 0 ? /* @__PURE__ */ Z(Yi, {
|
|
1994
2103
|
duration: 1,
|
|
1995
2104
|
children: "Thinking..."
|
|
1996
2105
|
}) : t === void 0 ? /* @__PURE__ */ Z("p", { children: "Thought for a few seconds" }) : /* @__PURE__ */ Q("p", { children: [
|
|
1997
2106
|
"Thought for ",
|
|
1998
2107
|
t,
|
|
1999
2108
|
" seconds"
|
|
2000
|
-
] }),
|
|
2001
|
-
let { isStreaming: i, isOpen: a, duration: o } =
|
|
2109
|
+
] }), na = a(({ className: e, children: t, getThinkingMessage: n = ta, ...r }) => {
|
|
2110
|
+
let { isStreaming: i, isOpen: a, duration: o } = Zi();
|
|
2002
2111
|
return /* @__PURE__ */ Z(E, {
|
|
2003
|
-
className:
|
|
2112
|
+
className: W("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground", e),
|
|
2004
2113
|
...r,
|
|
2005
2114
|
children: t ?? /* @__PURE__ */ Q(X, { children: [
|
|
2006
|
-
/* @__PURE__ */ Z(
|
|
2115
|
+
/* @__PURE__ */ Z(Le, { className: "size-4" }),
|
|
2007
2116
|
n(i, o),
|
|
2008
|
-
/* @__PURE__ */ Z(
|
|
2117
|
+
/* @__PURE__ */ Z(Ve, { className: W("size-4 transition-transform", a ? "rotate-180" : "rotate-0") })
|
|
2009
2118
|
] })
|
|
2010
2119
|
});
|
|
2011
|
-
}),
|
|
2012
|
-
className:
|
|
2120
|
+
}), ra = a(({ className: e, children: t, ...n }) => /* @__PURE__ */ Z(T, {
|
|
2121
|
+
className: W("mt-4 text-sm", "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", e),
|
|
2013
2122
|
...n,
|
|
2014
|
-
children: /* @__PURE__ */ Z(
|
|
2123
|
+
children: /* @__PURE__ */ Z(Nt, { children: t })
|
|
2015
2124
|
}));
|
|
2016
|
-
|
|
2125
|
+
ea.displayName = "Reasoning", na.displayName = "ReasoningTrigger", ra.displayName = "ReasoningContent";
|
|
2017
2126
|
//#endregion
|
|
2018
2127
|
//#region src/elements/sources.tsx
|
|
2019
|
-
var
|
|
2020
|
-
className:
|
|
2128
|
+
var ia = ({ className: e, ...t }) => /* @__PURE__ */ Z(w, {
|
|
2129
|
+
className: W("not-prose mb-4 text-primary text-xs", e),
|
|
2021
2130
|
...t
|
|
2022
|
-
}),
|
|
2023
|
-
className:
|
|
2131
|
+
}), aa = ({ className: e, count: t, children: n, ...r }) => /* @__PURE__ */ Z(E, {
|
|
2132
|
+
className: W("flex items-center gap-2", e),
|
|
2024
2133
|
...r,
|
|
2025
2134
|
children: n ?? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Q("p", {
|
|
2026
2135
|
className: "font-medium",
|
|
@@ -2029,24 +2138,24 @@ var Wi = ({ className: e, ...t }) => /* @__PURE__ */ Z(w, {
|
|
|
2029
2138
|
t,
|
|
2030
2139
|
" sources"
|
|
2031
2140
|
]
|
|
2032
|
-
}), /* @__PURE__ */ Z(
|
|
2033
|
-
}),
|
|
2034
|
-
className:
|
|
2141
|
+
}), /* @__PURE__ */ Z(Ve, { className: "h-4 w-4" })] })
|
|
2142
|
+
}), oa = ({ className: e, ...t }) => /* @__PURE__ */ Z(T, {
|
|
2143
|
+
className: W("mt-3 flex w-fit flex-col gap-2", "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in", e),
|
|
2035
2144
|
...t
|
|
2036
|
-
}),
|
|
2145
|
+
}), sa = ({ href: e, title: t, children: n, ...r }) => /* @__PURE__ */ Z("a", {
|
|
2037
2146
|
className: "flex items-center gap-2",
|
|
2038
2147
|
href: e,
|
|
2039
2148
|
rel: "noreferrer",
|
|
2040
2149
|
target: "_blank",
|
|
2041
2150
|
...r,
|
|
2042
|
-
children: n ?? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(
|
|
2151
|
+
children: n ?? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(Fe, { className: "h-4 w-4" }), /* @__PURE__ */ Z("span", {
|
|
2043
2152
|
className: "block font-medium",
|
|
2044
2153
|
children: t
|
|
2045
2154
|
})] })
|
|
2046
2155
|
});
|
|
2047
2156
|
//#endregion
|
|
2048
2157
|
//#region src/ChatbotEnhanced.tsx
|
|
2049
|
-
function
|
|
2158
|
+
function ca(e) {
|
|
2050
2159
|
let t = e ?? {}, n = t.data && typeof t.data == "object" ? t.data : t, r = n.seedApplied, i = n.probes;
|
|
2051
2160
|
if (!r && !i) return;
|
|
2052
2161
|
let a = {};
|
|
@@ -2060,10 +2169,10 @@ function Ji(e) {
|
|
|
2060
2169
|
message: String(e.message)
|
|
2061
2170
|
}))), a;
|
|
2062
2171
|
}
|
|
2063
|
-
function
|
|
2172
|
+
function la(e) {
|
|
2064
2173
|
return e === "user" ? "user" : "assistant";
|
|
2065
2174
|
}
|
|
2066
|
-
function
|
|
2175
|
+
function ua(e) {
|
|
2067
2176
|
let t = e.trim();
|
|
2068
2177
|
if (t.length < 2 || !(t.startsWith("{") || t.startsWith("[")) || !(t.endsWith("}") || t.endsWith("]"))) return !1;
|
|
2069
2178
|
try {
|
|
@@ -2072,15 +2181,15 @@ function Xi(e) {
|
|
|
2072
2181
|
return !1;
|
|
2073
2182
|
}
|
|
2074
2183
|
}
|
|
2075
|
-
function
|
|
2076
|
-
let t =
|
|
2184
|
+
function da(e) {
|
|
2185
|
+
let t = $(e)?.status;
|
|
2077
2186
|
return t === "changes_proposed" || t === "blueprint_proposed" || t === "awaiting_confirmation";
|
|
2078
2187
|
}
|
|
2079
|
-
function
|
|
2188
|
+
function fa(e) {
|
|
2080
2189
|
let t = e.state ?? (e.errorText ? "output-error" : e.result === void 0 ? "input-available" : "output-available");
|
|
2081
|
-
return t === "output-error" || t === "output-denied" ? "failed" : t === "approval-requested" || t === "approval-responded" ? "awaiting" : t === "output-available" ?
|
|
2190
|
+
return t === "output-error" || t === "output-denied" ? "failed" : t === "approval-requested" || t === "approval-responded" ? "awaiting" : t === "output-available" ? da(e.result) ? "awaiting" : "completed" : "running";
|
|
2082
2191
|
}
|
|
2083
|
-
var
|
|
2192
|
+
var pa = {
|
|
2084
2193
|
create_object: "Create object",
|
|
2085
2194
|
add_field: "Add field",
|
|
2086
2195
|
modify_field: "Modify field",
|
|
@@ -2090,20 +2199,20 @@ var $i = {
|
|
|
2090
2199
|
create_seed: "Generate sample data",
|
|
2091
2200
|
create_package: "Create app package"
|
|
2092
2201
|
};
|
|
2093
|
-
function
|
|
2202
|
+
function ma(e, t = pa) {
|
|
2094
2203
|
return [
|
|
2095
|
-
t[e.verb] ??
|
|
2204
|
+
t[e.verb] ?? pa[e.verb] ?? e.verb,
|
|
2096
2205
|
`${e.field ? `${e.object ? `${e.object}.` : ""}${e.field}` : e.object ?? e.name ?? ""}${e.type ? ` (${e.type})` : ""}`,
|
|
2097
2206
|
e.details
|
|
2098
2207
|
].filter(Boolean).join(" ");
|
|
2099
2208
|
}
|
|
2100
|
-
function
|
|
2209
|
+
function ha(e) {
|
|
2101
2210
|
return e.toolName === "propose_blueprint";
|
|
2102
2211
|
}
|
|
2103
|
-
function
|
|
2104
|
-
return
|
|
2212
|
+
function ga(e) {
|
|
2213
|
+
return ha(e) && fa(e) === "completed" && !e.proposedPlan && !e.proposedChanges && !e.draftReview?.items.length;
|
|
2105
2214
|
}
|
|
2106
|
-
var
|
|
2215
|
+
var _a = [
|
|
2107
2216
|
"待补",
|
|
2108
2217
|
"后续",
|
|
2109
2218
|
"将在",
|
|
@@ -2129,25 +2238,25 @@ var ra = [
|
|
|
2129
2238
|
"coming soon",
|
|
2130
2239
|
"tbd"
|
|
2131
2240
|
];
|
|
2132
|
-
function
|
|
2241
|
+
function va(e) {
|
|
2133
2242
|
let t = [], n = [];
|
|
2134
2243
|
for (let r of e) {
|
|
2135
2244
|
if (typeof r != "string") continue;
|
|
2136
2245
|
let e = r.trim();
|
|
2137
2246
|
if (!e) continue;
|
|
2138
2247
|
let i = e.toLowerCase();
|
|
2139
|
-
|
|
2248
|
+
_a.some((e) => i.includes(e)) ? n.push(e) : t.push(e);
|
|
2140
2249
|
}
|
|
2141
2250
|
return {
|
|
2142
2251
|
designNotes: t,
|
|
2143
2252
|
deferred: n
|
|
2144
2253
|
};
|
|
2145
2254
|
}
|
|
2146
|
-
function
|
|
2147
|
-
let t =
|
|
2148
|
-
return t === "awaiting" || t === "failed" || !!e.pendingActionId || !!e.draftReview?.items.length || !!e.proposedPlan || !!e.proposedChanges || !!e.builderHandoff ||
|
|
2255
|
+
function ya(e) {
|
|
2256
|
+
let t = fa(e);
|
|
2257
|
+
return t === "awaiting" || t === "failed" || !!e.pendingActionId || !!e.draftReview?.items.length || !!e.proposedPlan || !!e.proposedChanges || !!e.builderHandoff || ga(e);
|
|
2149
2258
|
}
|
|
2150
|
-
function
|
|
2259
|
+
function ba(e) {
|
|
2151
2260
|
switch (e) {
|
|
2152
2261
|
case "failed": return 4;
|
|
2153
2262
|
case "awaiting": return 3;
|
|
@@ -2155,20 +2264,20 @@ function oa(e) {
|
|
|
2155
2264
|
case "completed": return 1;
|
|
2156
2265
|
}
|
|
2157
2266
|
}
|
|
2158
|
-
function
|
|
2267
|
+
function xa(e) {
|
|
2159
2268
|
return /^\((?:called [^)]*|tool call|no content)\)$/.test(e.trim());
|
|
2160
2269
|
}
|
|
2161
|
-
function
|
|
2270
|
+
function Sa(e) {
|
|
2162
2271
|
let t = /* @__PURE__ */ new Map();
|
|
2163
2272
|
for (let n of e) {
|
|
2164
|
-
let e =
|
|
2273
|
+
let e = fa(n), r = `${n.toolName}:${e}`, i = t.get(r);
|
|
2165
2274
|
if (i) {
|
|
2166
2275
|
i.count += 1, i.errorText = i.errorText ?? n.errorText;
|
|
2167
2276
|
continue;
|
|
2168
2277
|
}
|
|
2169
2278
|
t.set(r, {
|
|
2170
2279
|
key: r,
|
|
2171
|
-
title:
|
|
2280
|
+
title: or(n.toolName) || n.toolName,
|
|
2172
2281
|
rawName: n.toolName,
|
|
2173
2282
|
count: 1,
|
|
2174
2283
|
state: e,
|
|
@@ -2176,11 +2285,11 @@ function ca(e) {
|
|
|
2176
2285
|
});
|
|
2177
2286
|
}
|
|
2178
2287
|
return Array.from(t.values()).sort((e, t) => {
|
|
2179
|
-
let n =
|
|
2288
|
+
let n = ba(t.state) - ba(e.state);
|
|
2180
2289
|
return n === 0 ? e.title.localeCompare(t.title) : n;
|
|
2181
2290
|
});
|
|
2182
2291
|
}
|
|
2183
|
-
function
|
|
2292
|
+
function Ca({ health: e }) {
|
|
2184
2293
|
if (!e) return null;
|
|
2185
2294
|
let t = e.issues ?? [], n = t.filter((e) => e.severity === "error"), r = t.filter((e) => e.severity !== "error"), i = e.checked, a = !!i && i.seeds + i.views + i.widgets > 0, o = [];
|
|
2186
2295
|
if (typeof e.seededRows == "number" && e.seededRows > 0 && !e.seedError && o.push(`${e.seededRows} sample row${e.seededRows === 1 ? "" : "s"} live`), a && n.length === 0) {
|
|
@@ -2193,25 +2302,25 @@ function la({ health: e }) {
|
|
|
2193
2302
|
children: [
|
|
2194
2303
|
o.length > 0 ? /* @__PURE__ */ Q("div", {
|
|
2195
2304
|
className: "flex items-center gap-1.5 text-xs text-emerald-700",
|
|
2196
|
-
children: [/* @__PURE__ */ Z(
|
|
2305
|
+
children: [/* @__PURE__ */ Z(G, { className: "size-3.5 shrink-0" }), /* @__PURE__ */ Z("span", { children: o.join(" · ") })]
|
|
2197
2306
|
}) : null,
|
|
2198
2307
|
e.seedError ? /* @__PURE__ */ Q("div", {
|
|
2199
2308
|
className: "flex items-start gap-1.5 text-xs text-red-600",
|
|
2200
|
-
children: [/* @__PURE__ */ Z(
|
|
2309
|
+
children: [/* @__PURE__ */ Z(J, { className: "mt-0.5 size-3.5 shrink-0" }), /* @__PURE__ */ Z("span", { children: e.seedError })]
|
|
2201
2310
|
}) : null,
|
|
2202
2311
|
n.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
2203
2312
|
className: "flex items-start gap-1.5 text-xs text-red-600",
|
|
2204
|
-
children: [/* @__PURE__ */ Z(
|
|
2313
|
+
children: [/* @__PURE__ */ Z(J, { className: "mt-0.5 size-3.5 shrink-0" }), /* @__PURE__ */ Z("span", { children: e.message })]
|
|
2205
2314
|
}, `e${t}`)),
|
|
2206
2315
|
r.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
2207
2316
|
className: "flex items-start gap-1.5 text-xs text-amber-600",
|
|
2208
|
-
children: [/* @__PURE__ */ Z(
|
|
2317
|
+
children: [/* @__PURE__ */ Z(Me, { className: "mt-0.5 size-3.5 shrink-0" }), /* @__PURE__ */ Z("span", { children: e.message })]
|
|
2209
2318
|
}, `w${t}`))
|
|
2210
2319
|
]
|
|
2211
2320
|
});
|
|
2212
2321
|
}
|
|
2213
|
-
var
|
|
2214
|
-
let
|
|
2322
|
+
var wa = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type your message...", onSendMessage: i, onClear: a, onStop: o, onReload: s, onUpgrade: c, disabled: l = !1, readOnly: u = !1, isLoading: d = !1, error: f, showTimestamp: p = !1, showAvatars: m = !1, userAvatarUrl: h, userAvatarFallback: g = "You", assistantAvatarUrl: _, assistantAvatarFallback: v = "AI", hideClearBar: y = !1, maxHeight: b = "500px", enableMarkdown: x = !0, enableFileUpload: S = !1, acceptedFileTypes: C = "image/*,.pdf,.doc,.docx,.txt,.csv,.tsv,.xlsx,.xlsm", maxFileSize: w = 10485760, suggestions: T, labels: E, models: D, selectedModelId: O, onModelChange: k, headerSlot: A, promptOverlaySlot: j, onInputChange: M, onToolApprove: N, toolApproveLabel: ee = "Approve", toolDenyLabel: P = "Deny", toolDenyReason: F = "User denied the operation", toolDecisions: I, onReviewDraft: te, toolReviewLabel: ne = (e) => `Review ${e} change${e === 1 ? "" : "s"}`, onPublishDrafts: L, onOpenBuiltApp: re, openBuiltAppLabel: ie = "Open app", onDesignBuiltApp: R, designBuiltAppLabel: ae = "Design in Studio", getArtifactAction: oe, onPreviewDraftApp: z, previewDraftLabel: B = "Preview", onDraftArtifacts: se, onBuildMaterialized: V, publishDraftsLabel: ce = "Publish", publishedLabel: le = "Published", verifiedLabel: ue = "Verified", nextStepsLabel: de = "What's next", planTitleLabel: fe = "Proposed plan", builderHandoffTitleLabel: pe = "Build this in the Builder", builderHandoffOpenLabel: me = "Open in Builder →", builderHandoffSupersededTitle: he = "A newer request is available", onOpenBuilder: ge, planExtendLabel: _e = "Adding to existing app", planQuestionsLabel: ve = "Confirm before building", planAssumptionsLabel: ye = "Assumptions", planDeferredLabel: be = "Not yet built", planApproveHintLabel: xe = "Reply to approve or adjust this plan.", planApproveLabel: H = "Build it", planAdjustLabel: U = "Adjust", planBuiltLabel: Se = "Built", planBuildingLabel: Ce = "Building…", planReadyLabel: we = "The plan is ready. Build it now, or tell me what to adjust.", planApproveMessage: Te = "Looks good — build it as proposed.", planApproveDefaultsMessage: Ee = "Build it with your best assumptions; use sensible defaults for the open questions.", planAnswerMessage: De = (e, t) => `For "${e}", go with: ${t}.`, changesTitleLabel: Oe = "Confirm changes", changesConfirmedLabel: ke = "Confirmed", changesConfirmLabel: Ae = "Confirm", changesConfirmHintLabel: je = "Reply to confirm or adjust this change.", changesConfirmMessage: Ne = "Confirm — apply the change you just proposed.", changeVerbLabels: Pe = pa, changesApplyingLabel: Fe = "Applying…", changesAppliedLabel: Le = "Applied", changesDraftedLabel: ze = "Saved as draft", changesFailedLabel: Be = "Not applied", surfaceContextLabel: Ve, fetchPendingDraftCount: He, autoPublishDrafts: Ue = !1, processVisibility: K = "summary", surface: Ge = "card", ...qe }, Ye) => {
|
|
2323
|
+
let Ze = d ? "streaming" : "ready", nt = Ge === "plain", [rt, at] = e.useState(null), ot = e.useRef(""), st = e.useRef(null), q = e.useMemo(() => ({
|
|
2215
2324
|
emptyTitle: E?.emptyTitle ?? "Start a conversation",
|
|
2216
2325
|
emptyDescription: E?.emptyDescription ?? "Ask anything — the assistant has access to your current app context.",
|
|
2217
2326
|
clear: E?.clear ?? "Clear",
|
|
@@ -2237,55 +2346,55 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2237
2346
|
connectionStalledLabel: E?.connectionStalledLabel ?? "Still working…",
|
|
2238
2347
|
connectionOfflineLabel: E?.connectionOfflineLabel ?? "Connection lost — reconnecting…",
|
|
2239
2348
|
designingPlanLabel: E?.designingPlanLabel ?? "Designing your app…",
|
|
2240
|
-
designingPlanHints: E?.designingPlanHints ??
|
|
2241
|
-
}), [E]), [
|
|
2242
|
-
if (
|
|
2243
|
-
let t = await
|
|
2244
|
-
|
|
2349
|
+
designingPlanHints: E?.designingPlanHints ?? Na
|
|
2350
|
+
}), [E]), [ct, lt] = e.useState(() => /* @__PURE__ */ new Set()), [ft, ht] = e.useState(() => /* @__PURE__ */ new Map()), [vt, yt] = e.useState(() => /* @__PURE__ */ new Map()), bt = e.useRef(/* @__PURE__ */ new Set()), xt = e.useCallback(async (e) => {
|
|
2351
|
+
if (He) try {
|
|
2352
|
+
let t = await He(e);
|
|
2353
|
+
yt((n) => {
|
|
2245
2354
|
if (n.get(e) === t) return n;
|
|
2246
2355
|
let r = new Map(n);
|
|
2247
2356
|
return r.set(e, t), r;
|
|
2248
2357
|
});
|
|
2249
2358
|
} catch {}
|
|
2250
|
-
}, [
|
|
2359
|
+
}, [He]);
|
|
2251
2360
|
e.useEffect(() => {
|
|
2252
|
-
if (!
|
|
2361
|
+
if (!He || d) return;
|
|
2253
2362
|
let e = /* @__PURE__ */ new Set();
|
|
2254
2363
|
for (let t of n) for (let n of t.toolInvocations ?? []) {
|
|
2255
2364
|
let t = n.draftReview?.packageId, r = n.toolCallId;
|
|
2256
|
-
t && r && !
|
|
2365
|
+
t && r && !bt.current.has(r) && (bt.current.add(r), e.add(t));
|
|
2257
2366
|
}
|
|
2258
|
-
for (let t of e)
|
|
2367
|
+
for (let t of e) xt(t);
|
|
2259
2368
|
}, [
|
|
2260
2369
|
n,
|
|
2261
2370
|
d,
|
|
2262
|
-
|
|
2263
|
-
|
|
2371
|
+
He,
|
|
2372
|
+
xt
|
|
2264
2373
|
]);
|
|
2265
|
-
let
|
|
2374
|
+
let Y = e.useCallback(async (e) => {
|
|
2266
2375
|
if (!L) return;
|
|
2267
2376
|
let t = [];
|
|
2268
2377
|
for (let r of n) for (let n of r.toolInvocations ?? []) n.draftReview?.packageId === e && n.toolCallId && t.push(n.toolCallId);
|
|
2269
2378
|
let r = await L(e), i = r && typeof r == "object" ? r : void 0;
|
|
2270
2379
|
if ((i ? i.ok !== !1 : r !== !1) && t.length > 0) {
|
|
2271
|
-
|
|
2380
|
+
lt((e) => {
|
|
2272
2381
|
let n = new Set(e);
|
|
2273
2382
|
for (let e of t) n.add(e);
|
|
2274
2383
|
return n;
|
|
2275
2384
|
});
|
|
2276
2385
|
let e = i?.health;
|
|
2277
|
-
e &&
|
|
2386
|
+
e && ht((n) => {
|
|
2278
2387
|
let r = new Map(n);
|
|
2279
2388
|
for (let n of t) r.set(n, e);
|
|
2280
2389
|
return r;
|
|
2281
2390
|
});
|
|
2282
2391
|
}
|
|
2283
|
-
|
|
2392
|
+
xt(e);
|
|
2284
2393
|
}, [
|
|
2285
2394
|
L,
|
|
2286
2395
|
n,
|
|
2287
|
-
|
|
2288
|
-
]),
|
|
2396
|
+
xt
|
|
2397
|
+
]), St = e.useRef(/* @__PURE__ */ new Set()), Ct = e.useRef(!1);
|
|
2289
2398
|
e.useEffect(() => {
|
|
2290
2399
|
let e = [];
|
|
2291
2400
|
for (let t of n) for (let n of t.toolInvocations ?? []) {
|
|
@@ -2295,27 +2404,27 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2295
2404
|
packageId: t.packageId
|
|
2296
2405
|
});
|
|
2297
2406
|
}
|
|
2298
|
-
if (!
|
|
2299
|
-
|
|
2300
|
-
for (let t of e)
|
|
2407
|
+
if (!Ct.current) {
|
|
2408
|
+
Ct.current = !0;
|
|
2409
|
+
for (let t of e) St.current.add(t.key);
|
|
2301
2410
|
return;
|
|
2302
2411
|
}
|
|
2303
|
-
if (!
|
|
2304
|
-
let t = e.filter((e) => !
|
|
2412
|
+
if (!Ue || !L || d) return;
|
|
2413
|
+
let t = e.filter((e) => !St.current.has(e.key));
|
|
2305
2414
|
if (t.length !== 0) {
|
|
2306
|
-
for (let e of t)
|
|
2307
|
-
for (let e of [...new Set(t.map((e) => e.packageId))])
|
|
2415
|
+
for (let e of t) St.current.add(e.key);
|
|
2416
|
+
for (let e of [...new Set(t.map((e) => e.packageId))]) Y(e);
|
|
2308
2417
|
}
|
|
2309
2418
|
}, [
|
|
2310
2419
|
n,
|
|
2311
2420
|
d,
|
|
2312
|
-
|
|
2421
|
+
Ue,
|
|
2313
2422
|
L,
|
|
2314
|
-
|
|
2423
|
+
Y
|
|
2315
2424
|
]);
|
|
2316
|
-
let
|
|
2425
|
+
let wt = e.useRef(/* @__PURE__ */ new Set());
|
|
2317
2426
|
e.useEffect(() => {
|
|
2318
|
-
if (!
|
|
2427
|
+
if (!se) return;
|
|
2319
2428
|
let e = /* @__PURE__ */ new Map(), t;
|
|
2320
2429
|
for (let r of n) {
|
|
2321
2430
|
for (let t of r.buildProgress?.items ?? []) t?.type && t?.name && e.set(`${t.type}:${t.name}`, t);
|
|
@@ -2325,69 +2434,82 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2325
2434
|
r?.packageId && r.items?.some((e) => e.type === "app") && (t = r.packageId);
|
|
2326
2435
|
}
|
|
2327
2436
|
}
|
|
2328
|
-
let r =
|
|
2437
|
+
let r = wt.current, i = !1;
|
|
2329
2438
|
for (let t of e.keys()) r.has(t) || (r.add(t), i = !0);
|
|
2330
|
-
i &&
|
|
2331
|
-
}, [n,
|
|
2332
|
-
let
|
|
2439
|
+
i && se([...e.values()], t);
|
|
2440
|
+
}, [n, se]);
|
|
2441
|
+
let Et = e.useRef(/* @__PURE__ */ new Set());
|
|
2333
2442
|
e.useEffect(() => {
|
|
2334
|
-
if (
|
|
2443
|
+
if (V) for (let e of n) for (let t of e.toolInvocations ?? []) {
|
|
2335
2444
|
let e = t.draftReview;
|
|
2336
2445
|
if (!e?.materialized || !t.toolCallId) continue;
|
|
2337
2446
|
let n = e.items.find((e) => e.type === "app");
|
|
2338
|
-
!n ||
|
|
2447
|
+
!n || Et.current.has(t.toolCallId) || (Et.current.add(t.toolCallId), V(n.name));
|
|
2339
2448
|
}
|
|
2340
|
-
}, [n,
|
|
2341
|
-
let
|
|
2449
|
+
}, [n, V]);
|
|
2450
|
+
let Dt = e.useCallback((e) => {
|
|
2342
2451
|
let t = !!e.text?.trim(), n = e.files?.map((e) => e.file).filter(Boolean), r = !!(n && n.length > 0);
|
|
2343
2452
|
if (!(t || r)) return;
|
|
2344
2453
|
let a = e.text?.trim() ?? "";
|
|
2345
|
-
|
|
2346
|
-
}, [i]),
|
|
2347
|
-
|
|
2348
|
-
}, [i]),
|
|
2349
|
-
t && (
|
|
2454
|
+
ot.current = a, st.current = null, Mt.current = null, i?.(a, n);
|
|
2455
|
+
}, [i]), Ot = e.useCallback((e) => {
|
|
2456
|
+
Mt.current = null, i?.(e);
|
|
2457
|
+
}, [i]), kt = e.useRef(null), [At, jt] = e.useState(() => /* @__PURE__ */ new Set()), Mt = e.useRef(null), Nt = e.useCallback((e, t) => {
|
|
2458
|
+
t && (Mt.current = t, jt((e) => {
|
|
2350
2459
|
let n = new Set(e);
|
|
2351
2460
|
return n.add(t), n;
|
|
2352
|
-
})), i?.(e ?
|
|
2461
|
+
})), i?.(e ? Ee : Te);
|
|
2353
2462
|
}, [
|
|
2354
2463
|
i,
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
]),
|
|
2358
|
-
|
|
2464
|
+
Te,
|
|
2465
|
+
Ee
|
|
2466
|
+
]), [Pt, Ft] = e.useState(() => /* @__PURE__ */ new Set()), It = e.useRef(null), Lt = e.useCallback((e) => {
|
|
2467
|
+
e && (It.current = e, Ft((t) => {
|
|
2468
|
+
let n = new Set(t);
|
|
2469
|
+
return n.add(e), n;
|
|
2470
|
+
})), i?.(Ne);
|
|
2471
|
+
}, [i, Ne]), Rt = e.useCallback(() => {
|
|
2472
|
+
let e = kt.current?.querySelector("textarea");
|
|
2359
2473
|
e && (e.focus(), e.scrollIntoView({ block: "nearest" }));
|
|
2360
2474
|
}, []);
|
|
2361
2475
|
e.useEffect(() => {
|
|
2362
|
-
if (!f ||
|
|
2363
|
-
if (
|
|
2364
|
-
let e =
|
|
2365
|
-
|
|
2476
|
+
if (!f || !pr(f) || st.current === f) return;
|
|
2477
|
+
if (st.current = f, Mt.current) {
|
|
2478
|
+
let e = Mt.current;
|
|
2479
|
+
Mt.current = null, jt((t) => {
|
|
2366
2480
|
if (!t.has(e)) return t;
|
|
2367
2481
|
let n = new Set(t);
|
|
2368
2482
|
return n.delete(e), n;
|
|
2369
2483
|
});
|
|
2370
2484
|
}
|
|
2371
|
-
|
|
2485
|
+
if (It.current) {
|
|
2486
|
+
let e = It.current;
|
|
2487
|
+
It.current = null, Ft((t) => {
|
|
2488
|
+
if (!t.has(e)) return t;
|
|
2489
|
+
let n = new Set(t);
|
|
2490
|
+
return n.delete(e), n;
|
|
2491
|
+
});
|
|
2492
|
+
}
|
|
2493
|
+
let e = ot.current;
|
|
2372
2494
|
if (!e) return;
|
|
2373
|
-
let t =
|
|
2495
|
+
let t = kt.current?.querySelector("textarea");
|
|
2374
2496
|
t && t.value.trim() === "" && (t.value = e, t.dispatchEvent(new Event("input", { bubbles: !0 })), t.focus());
|
|
2375
2497
|
}, [f]);
|
|
2376
|
-
let
|
|
2377
|
-
navigator.clipboard?.writeText(e.content),
|
|
2378
|
-
}, []),
|
|
2498
|
+
let zt = e.useCallback((e) => {
|
|
2499
|
+
navigator.clipboard?.writeText(e.content), at(e.id), window.setTimeout(() => at((t) => t === e.id ? null : t), 1500);
|
|
2500
|
+
}, []), Bt = e.useMemo(() => {
|
|
2379
2501
|
let e = /* @__PURE__ */ new Set(), t = [], r = -1, i = 0;
|
|
2380
|
-
for (let e of n) for (let n of e.toolInvocations ?? []) (n.proposedPlan ||
|
|
2502
|
+
for (let e of n) for (let n of e.toolInvocations ?? []) (n.proposedPlan || ga(n)) && n.toolCallId && t.push({
|
|
2381
2503
|
id: n.toolCallId,
|
|
2382
2504
|
order: i
|
|
2383
2505
|
}), n.toolName === "apply_blueprint" && (r = i), i += 1;
|
|
2384
2506
|
for (let n of t) n.order < r && e.add(n.id);
|
|
2385
2507
|
return e;
|
|
2386
|
-
}, [n]),
|
|
2508
|
+
}, [n]), Vt = e.useMemo(() => {
|
|
2387
2509
|
let e;
|
|
2388
2510
|
for (let t of n) for (let n of t.toolInvocations ?? []) n.builderHandoff && n.toolCallId && (e = n.toolCallId);
|
|
2389
2511
|
return e;
|
|
2390
|
-
}, [n]),
|
|
2512
|
+
}, [n]), Ht = e.useMemo(() => {
|
|
2391
2513
|
let e = /* @__PURE__ */ new Set(), t = [], r = /* @__PURE__ */ new Map(), i = 0;
|
|
2392
2514
|
for (let e of n) for (let n of e.toolInvocations ?? []) n.proposedChanges && n.toolCallId ? t.push({
|
|
2393
2515
|
id: n.toolCallId,
|
|
@@ -2399,8 +2521,27 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2399
2521
|
t !== void 0 && t > n.order && e.add(n.id);
|
|
2400
2522
|
}
|
|
2401
2523
|
return e;
|
|
2402
|
-
}, [n]),
|
|
2403
|
-
let
|
|
2524
|
+
}, [n]), Ut = e.useMemo(() => {
|
|
2525
|
+
let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), r = [], i = 0;
|
|
2526
|
+
for (let a of n) for (let n of a.toolInvocations ?? []) {
|
|
2527
|
+
if (n.proposedChanges && n.toolCallId) r.push({
|
|
2528
|
+
id: n.toolCallId,
|
|
2529
|
+
toolName: n.toolName ?? "",
|
|
2530
|
+
order: i
|
|
2531
|
+
}), t.delete(n.toolCallId);
|
|
2532
|
+
else if (n.toolCallId?.startsWith("replay_")) {
|
|
2533
|
+
let a;
|
|
2534
|
+
for (let e of r) e.order < i && e.toolName === (n.toolName ?? "") && (a = e);
|
|
2535
|
+
a && (n.replayOutcome ? (e.set(a.id, n.replayOutcome), n.replayOutcome.dispatchError ? t.set(a.id, i) : t.delete(a.id)) : n.result === void 0 && !n.errorText && e.set(a.id, { kind: "applying" }));
|
|
2536
|
+
} else if (n.result !== void 0 && t.size > 0) {
|
|
2537
|
+
let r = Zt(n.result);
|
|
2538
|
+
if (r) for (let [n, a] of t) i > a && e.set(n, r);
|
|
2539
|
+
}
|
|
2540
|
+
i += 1;
|
|
2541
|
+
}
|
|
2542
|
+
return e;
|
|
2543
|
+
}, [n]), Wt = (e) => {
|
|
2544
|
+
let t = e.state ?? (e.errorText ? "output-error" : e.result === void 0 ? "input-available" : "output-available"), n = `tool-${e.toolName}`, r = I?.[e.toolCallId], a = t === "approval-requested" && !!N && !r, o = t === "approval-requested" && !!e.pendingActionId, s = or(e.toolName), c = sr(e.result), l = K === "debug" && s && s.toLowerCase() !== e.toolName.toLowerCase(), u = K === "debug" || a, d = e.draftReview?.packageId, f = d === void 0 ? void 0 : vt.get(d), p = f === void 0 ? ct.has(e.toolCallId) : f === 0, m = t === "input-streaming" || t === "input-available", h = t === "output-available" && da(e.result) ? "approval-requested" : t, g = /* @__PURE__ */ Q("span", {
|
|
2404
2545
|
className: "inline-flex min-w-0 items-center gap-2",
|
|
2405
2546
|
children: [
|
|
2406
2547
|
/* @__PURE__ */ Z("span", { children: s || e.toolName }),
|
|
@@ -2408,22 +2549,22 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2408
2549
|
className: "rounded bg-muted px-1 py-px text-[10px] font-mono text-muted-foreground",
|
|
2409
2550
|
children: e.toolName
|
|
2410
2551
|
}) : null,
|
|
2411
|
-
m ?
|
|
2412
|
-
label:
|
|
2413
|
-
hints:
|
|
2414
|
-
offlineLabel:
|
|
2415
|
-
}) : /* @__PURE__ */ Z(
|
|
2552
|
+
m ? ha(e) ? /* @__PURE__ */ Z(Ia, {
|
|
2553
|
+
label: q.designingPlanLabel,
|
|
2554
|
+
hints: q.designingPlanHints,
|
|
2555
|
+
offlineLabel: q.connectionOfflineLabel
|
|
2556
|
+
}) : /* @__PURE__ */ Z(La, { offlineLabel: q.connectionOfflineLabel }) : null
|
|
2416
2557
|
]
|
|
2417
2558
|
});
|
|
2418
|
-
return /* @__PURE__ */ Q(
|
|
2419
|
-
defaultOpen: t === "output-error" || t === "approval-requested" || !!(e.draftReview && e.draftReview.items.length > 0) || !!e.proposedPlan || !!e.proposedChanges || !!e.builderHandoff ||
|
|
2420
|
-
children: [/* @__PURE__ */ Z(
|
|
2559
|
+
return /* @__PURE__ */ Q(Ui, {
|
|
2560
|
+
defaultOpen: t === "output-error" || t === "approval-requested" || !!(e.draftReview && e.draftReview.items.length > 0) || !!e.proposedPlan || !!e.proposedChanges || !!e.builderHandoff || ga(e),
|
|
2561
|
+
children: [/* @__PURE__ */ Z(Gi, {
|
|
2421
2562
|
type: n,
|
|
2422
2563
|
state: h,
|
|
2423
2564
|
title: g
|
|
2424
|
-
}), /* @__PURE__ */ Q(
|
|
2425
|
-
u && e.args !== void 0 ? /* @__PURE__ */ Z(
|
|
2426
|
-
o ? null : u || t === "output-error" ? /* @__PURE__ */ Z(
|
|
2565
|
+
}), /* @__PURE__ */ Q(Ki, { children: [
|
|
2566
|
+
u && e.args !== void 0 ? /* @__PURE__ */ Z(qi, { input: e.args }) : null,
|
|
2567
|
+
o ? null : u || t === "output-error" ? /* @__PURE__ */ Z(qa, {
|
|
2427
2568
|
output: c,
|
|
2428
2569
|
errorText: e.errorText
|
|
2429
2570
|
}) : null,
|
|
@@ -2455,18 +2596,18 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2455
2596
|
L && e.draftReview.packageId ? p ? /* @__PURE__ */ Q("span", {
|
|
2456
2597
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700",
|
|
2457
2598
|
children: [
|
|
2458
|
-
/* @__PURE__ */ Z(
|
|
2459
|
-
|
|
2599
|
+
/* @__PURE__ */ Z(G, { className: "size-3.5" }),
|
|
2600
|
+
le,
|
|
2460
2601
|
e.draftReview.failedCount ? ` · ${e.draftReview.failedCount} need${e.draftReview.failedCount === 1 ? "s" : ""} attention` : ""
|
|
2461
2602
|
]
|
|
2462
2603
|
}) : /* @__PURE__ */ Q("button", {
|
|
2463
2604
|
type: "button",
|
|
2464
|
-
onClick: () => void
|
|
2605
|
+
onClick: () => void Y(e.draftReview.packageId),
|
|
2465
2606
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
|
|
2466
2607
|
"data-testid": "draft-publish",
|
|
2467
2608
|
children: [
|
|
2468
|
-
/* @__PURE__ */ Z(
|
|
2469
|
-
|
|
2609
|
+
/* @__PURE__ */ Z(dt, { className: "size-3.5" }),
|
|
2610
|
+
ce,
|
|
2470
2611
|
typeof f == "number" && f > 0 ? ` (${f})` : ""
|
|
2471
2612
|
]
|
|
2472
2613
|
}) : null,
|
|
@@ -2474,7 +2615,7 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2474
2615
|
type: "button",
|
|
2475
2616
|
onClick: () => te(e.draftReview.items),
|
|
2476
2617
|
className: L && e.draftReview.packageId ? "inline-flex h-7 items-center gap-1.5 rounded-md border px-3 text-xs font-medium hover:bg-muted" : "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
|
|
2477
|
-
children: [/* @__PURE__ */ Z(
|
|
2618
|
+
children: [/* @__PURE__ */ Z($e, { className: "size-3.5" }), ne(e.draftReview.items.length)]
|
|
2478
2619
|
}) : null,
|
|
2479
2620
|
z && !p ? (() => {
|
|
2480
2621
|
let t = e.draftReview.items.find((e) => e.type === "app");
|
|
@@ -2486,17 +2627,17 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2486
2627
|
}),
|
|
2487
2628
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md border px-3 text-xs font-medium hover:bg-muted",
|
|
2488
2629
|
"data-testid": "draft-preview-app",
|
|
2489
|
-
children: [/* @__PURE__ */ Z(
|
|
2630
|
+
children: [/* @__PURE__ */ Z(Qe, { className: "size-3.5" }), B]
|
|
2490
2631
|
}) : null;
|
|
2491
2632
|
})() : null,
|
|
2492
2633
|
e.draftReview.verification ? e.draftReview.verification.errors > 0 ? /* @__PURE__ */ Q("span", {
|
|
2493
2634
|
className: "inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-amber-200 bg-amber-50 px-2.5 text-xs font-medium text-amber-700",
|
|
2494
2635
|
"data-testid": "draft-verification-chip",
|
|
2495
|
-
children: [/* @__PURE__ */ Z(
|
|
2636
|
+
children: [/* @__PURE__ */ Z(_t, { className: "size-3.5" }), `${e.draftReview.verification.errors} issue${e.draftReview.verification.errors === 1 ? "" : "s"}`]
|
|
2496
2637
|
}) : /* @__PURE__ */ Q("span", {
|
|
2497
2638
|
className: "inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-2.5 text-xs font-medium text-emerald-700",
|
|
2498
2639
|
"data-testid": "draft-verification-chip",
|
|
2499
|
-
children: [/* @__PURE__ */ Z(
|
|
2640
|
+
children: [/* @__PURE__ */ Z(pt, { className: "size-3.5" }), ue]
|
|
2500
2641
|
}) : null,
|
|
2501
2642
|
e.draftReview.summary ? /* @__PURE__ */ Z("span", {
|
|
2502
2643
|
className: "min-w-0 flex-1 truncate text-xs text-muted-foreground",
|
|
@@ -2509,19 +2650,19 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2509
2650
|
"data-testid": "draft-issues",
|
|
2510
2651
|
children: [e.draftReview.issues.filter((e) => e.severity === "error").map((e, t) => /* @__PURE__ */ Q("div", {
|
|
2511
2652
|
className: "flex items-start gap-1.5 text-xs text-red-600",
|
|
2512
|
-
children: [/* @__PURE__ */ Z(
|
|
2653
|
+
children: [/* @__PURE__ */ Z(J, { className: "mt-0.5 size-3.5 shrink-0" }), /* @__PURE__ */ Z("span", { children: e.fix ? `${e.message} — ${e.fix}` : e.message })]
|
|
2513
2654
|
}, `e${t}`)), e.draftReview.issues.filter((e) => e.severity !== "error").map((e, t) => /* @__PURE__ */ Q("div", {
|
|
2514
2655
|
className: "flex items-start gap-1.5 text-xs text-amber-600",
|
|
2515
|
-
children: [/* @__PURE__ */ Z(
|
|
2656
|
+
children: [/* @__PURE__ */ Z(Me, { className: "mt-0.5 size-3.5 shrink-0" }), /* @__PURE__ */ Z("span", { children: e.message })]
|
|
2516
2657
|
}, `w${t}`))]
|
|
2517
2658
|
}) : null,
|
|
2518
|
-
|
|
2659
|
+
ct.has(e.toolCallId) ? /* @__PURE__ */ Z(Ca, { health: ft.get(e.toolCallId) }) : null,
|
|
2519
2660
|
e.draftReview.nextSteps && e.draftReview.nextSteps.length > 0 ? /* @__PURE__ */ Q("div", {
|
|
2520
2661
|
className: "flex flex-col gap-1 border-t bg-muted/20 px-3 py-2",
|
|
2521
2662
|
"data-testid": "draft-next-steps",
|
|
2522
2663
|
children: [/* @__PURE__ */ Z("span", {
|
|
2523
2664
|
className: "text-xs font-medium text-foreground/80",
|
|
2524
|
-
children:
|
|
2665
|
+
children: de
|
|
2525
2666
|
}), e.draftReview.nextSteps.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
2526
2667
|
className: "flex items-start gap-1.5 text-xs text-muted-foreground",
|
|
2527
2668
|
children: [/* @__PURE__ */ Z("span", {
|
|
@@ -2537,22 +2678,22 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2537
2678
|
children: [
|
|
2538
2679
|
/* @__PURE__ */ Q("span", {
|
|
2539
2680
|
className: "inline-flex items-center gap-1.5 text-xs font-medium text-foreground/80",
|
|
2540
|
-
children: [/* @__PURE__ */ Z(
|
|
2681
|
+
children: [/* @__PURE__ */ Z(mt, { className: "size-3.5" }), pe]
|
|
2541
2682
|
}),
|
|
2542
2683
|
/* @__PURE__ */ Z("p", {
|
|
2543
2684
|
className: "text-xs text-muted-foreground",
|
|
2544
2685
|
children: e.builderHandoff.prompt
|
|
2545
2686
|
}),
|
|
2546
2687
|
(() => {
|
|
2547
|
-
let t = !!
|
|
2688
|
+
let t = !!Vt && e.toolCallId !== Vt;
|
|
2548
2689
|
return /* @__PURE__ */ Z("button", {
|
|
2549
2690
|
type: "button",
|
|
2550
|
-
onClick: () =>
|
|
2551
|
-
disabled: !
|
|
2691
|
+
onClick: () => ge?.(e.builderHandoff),
|
|
2692
|
+
disabled: !ge || t,
|
|
2552
2693
|
"data-testid": t ? "builder-handoff-superseded" : "builder-handoff-open",
|
|
2553
|
-
title: t ?
|
|
2694
|
+
title: t ? he : void 0,
|
|
2554
2695
|
className: "inline-flex w-fit items-center gap-1 rounded-md bg-primary px-2.5 py-1 text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-50",
|
|
2555
|
-
children:
|
|
2696
|
+
children: me
|
|
2556
2697
|
});
|
|
2557
2698
|
})()
|
|
2558
2699
|
]
|
|
@@ -2563,14 +2704,14 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2563
2704
|
children: [
|
|
2564
2705
|
/* @__PURE__ */ Q("span", {
|
|
2565
2706
|
className: "inline-flex items-center gap-1.5 text-xs font-medium text-foreground/80",
|
|
2566
|
-
children: [/* @__PURE__ */ Z(
|
|
2707
|
+
children: [/* @__PURE__ */ Z(We, { className: "size-3.5" }), fe]
|
|
2567
2708
|
}),
|
|
2568
2709
|
e.proposedPlan.targetApp ? /* @__PURE__ */ Q("span", {
|
|
2569
2710
|
className: "inline-flex w-fit items-center gap-1 rounded-md border border-blue-200 bg-blue-50 px-2 py-0.5 text-[11px] font-medium text-blue-700 dark:border-blue-900/50 dark:bg-blue-950/30 dark:text-blue-300",
|
|
2570
2711
|
"data-testid": "proposed-plan-extend",
|
|
2571
2712
|
children: [
|
|
2572
2713
|
"+ ",
|
|
2573
|
-
|
|
2714
|
+
_e,
|
|
2574
2715
|
" \"",
|
|
2575
2716
|
e.proposedPlan.targetApp,
|
|
2576
2717
|
"\""
|
|
@@ -2586,7 +2727,7 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2586
2727
|
className: "inline-flex items-center gap-1 rounded-md border bg-background px-1.5 py-0.5 text-[11px] text-foreground/80",
|
|
2587
2728
|
title: e.name,
|
|
2588
2729
|
children: [
|
|
2589
|
-
/* @__PURE__ */ Z(
|
|
2730
|
+
/* @__PURE__ */ Z(gt, { className: "size-3 text-foreground/40" }),
|
|
2590
2731
|
e.label || e.name,
|
|
2591
2732
|
e.fieldCount > 0 ? /* @__PURE__ */ Q("span", {
|
|
2592
2733
|
className: "text-foreground/40",
|
|
@@ -2603,13 +2744,13 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2603
2744
|
}) : null;
|
|
2604
2745
|
})(),
|
|
2605
2746
|
(() => {
|
|
2606
|
-
let { designNotes: t, deferred: n } =
|
|
2747
|
+
let { designNotes: t, deferred: n } = va(e.proposedPlan.assumptions);
|
|
2607
2748
|
return /* @__PURE__ */ Q(X, { children: [t.length > 0 ? /* @__PURE__ */ Q("div", {
|
|
2608
2749
|
className: "flex flex-col gap-0.5",
|
|
2609
2750
|
"data-testid": "proposed-plan-assumptions",
|
|
2610
2751
|
children: [/* @__PURE__ */ Z("span", {
|
|
2611
2752
|
className: "text-[11px] font-medium text-foreground/70",
|
|
2612
|
-
children:
|
|
2753
|
+
children: ye
|
|
2613
2754
|
}), t.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
2614
2755
|
className: "flex items-start gap-1.5 text-[11px] text-muted-foreground",
|
|
2615
2756
|
children: [/* @__PURE__ */ Z("span", {
|
|
@@ -2622,7 +2763,7 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2622
2763
|
"data-testid": "proposed-plan-deferred",
|
|
2623
2764
|
children: [/* @__PURE__ */ Q("span", {
|
|
2624
2765
|
className: "inline-flex items-center gap-1.5 text-[11px] font-medium text-amber-800 dark:text-amber-300",
|
|
2625
|
-
children: [/* @__PURE__ */ Z(
|
|
2766
|
+
children: [/* @__PURE__ */ Z(tt, { className: "size-3.5" }), be]
|
|
2626
2767
|
}), n.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
2627
2768
|
className: "flex items-start gap-1.5 text-[11px] text-amber-900/90 dark:text-amber-200/90",
|
|
2628
2769
|
children: [/* @__PURE__ */ Z("span", {
|
|
@@ -2637,7 +2778,7 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2637
2778
|
"data-testid": "proposed-plan-questions",
|
|
2638
2779
|
children: [/* @__PURE__ */ Q("span", {
|
|
2639
2780
|
className: "inline-flex items-center gap-1.5 text-[11px] font-medium text-amber-800 dark:text-amber-300",
|
|
2640
|
-
children: [/* @__PURE__ */ Z(
|
|
2781
|
+
children: [/* @__PURE__ */ Z(et, { className: "size-3.5" }), ve]
|
|
2641
2782
|
}), e.proposedPlan.questions.map((t, n) => {
|
|
2642
2783
|
let r = e.proposedPlan.questionChoices?.find((e) => e.text === t);
|
|
2643
2784
|
return /* @__PURE__ */ Q("div", {
|
|
@@ -2653,7 +2794,7 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2653
2794
|
"data-testid": "proposed-plan-choice",
|
|
2654
2795
|
children: r.options.map((e, n) => /* @__PURE__ */ Z("button", {
|
|
2655
2796
|
type: "button",
|
|
2656
|
-
onClick: () => i(
|
|
2797
|
+
onClick: () => i(De(t, e)),
|
|
2657
2798
|
className: "inline-flex h-6 items-center rounded-full border border-amber-300 bg-background px-2 text-[11px] font-medium text-amber-900 hover:bg-amber-100 dark:border-amber-800 dark:text-amber-200 dark:hover:bg-amber-900/40",
|
|
2658
2799
|
children: e
|
|
2659
2800
|
}, n))
|
|
@@ -2661,91 +2802,91 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2661
2802
|
}, n);
|
|
2662
2803
|
})]
|
|
2663
2804
|
}) : null,
|
|
2664
|
-
i ?
|
|
2805
|
+
i ? Bt.has(e.toolCallId) ? /* @__PURE__ */ Z("div", {
|
|
2665
2806
|
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
2666
2807
|
"data-testid": "proposed-plan-actions",
|
|
2667
2808
|
children: /* @__PURE__ */ Q("span", {
|
|
2668
2809
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-300",
|
|
2669
2810
|
"data-testid": "proposed-plan-built",
|
|
2670
|
-
children: [/* @__PURE__ */ Z(
|
|
2811
|
+
children: [/* @__PURE__ */ Z(G, { className: "size-3.5" }), Se]
|
|
2671
2812
|
})
|
|
2672
|
-
}) :
|
|
2813
|
+
}) : At.has(e.toolCallId) ? /* @__PURE__ */ Z("div", {
|
|
2673
2814
|
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
2674
2815
|
"data-testid": "proposed-plan-actions",
|
|
2675
2816
|
children: /* @__PURE__ */ Q("span", {
|
|
2676
2817
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md border bg-muted/40 px-3 text-xs font-medium text-muted-foreground",
|
|
2677
2818
|
"data-testid": "proposed-plan-building",
|
|
2678
|
-
children: [/* @__PURE__ */ Z(
|
|
2819
|
+
children: [/* @__PURE__ */ Z(it, { className: "size-3.5 animate-spin" }), Ce]
|
|
2679
2820
|
})
|
|
2680
2821
|
}) : /* @__PURE__ */ Q("div", {
|
|
2681
2822
|
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
2682
2823
|
"data-testid": "proposed-plan-actions",
|
|
2683
2824
|
children: [/* @__PURE__ */ Q("button", {
|
|
2684
2825
|
type: "button",
|
|
2685
|
-
onClick: () =>
|
|
2826
|
+
onClick: () => Nt(e.proposedPlan.questions.length > 0, e.toolCallId),
|
|
2686
2827
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
|
|
2687
2828
|
"data-testid": "proposed-plan-approve",
|
|
2688
|
-
children: [/* @__PURE__ */ Z(
|
|
2829
|
+
children: [/* @__PURE__ */ Z(dt, { className: "size-3.5" }), H]
|
|
2689
2830
|
}), /* @__PURE__ */ Z("button", {
|
|
2690
2831
|
type: "button",
|
|
2691
|
-
onClick:
|
|
2832
|
+
onClick: Rt,
|
|
2692
2833
|
className: "inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent",
|
|
2693
2834
|
"data-testid": "proposed-plan-adjust",
|
|
2694
|
-
children:
|
|
2835
|
+
children: U
|
|
2695
2836
|
})]
|
|
2696
2837
|
}) : /* @__PURE__ */ Z("span", {
|
|
2697
2838
|
className: "text-[11px] italic text-muted-foreground/80",
|
|
2698
|
-
children:
|
|
2839
|
+
children: xe
|
|
2699
2840
|
})
|
|
2700
2841
|
]
|
|
2701
2842
|
}) : null,
|
|
2702
|
-
|
|
2843
|
+
ga(e) ? /* @__PURE__ */ Q("div", {
|
|
2703
2844
|
className: "flex flex-col gap-2 border-t bg-muted/20 px-3 py-2.5",
|
|
2704
2845
|
"data-testid": "proposed-plan-fallback",
|
|
2705
2846
|
children: [
|
|
2706
2847
|
/* @__PURE__ */ Q("span", {
|
|
2707
2848
|
className: "inline-flex items-center gap-1.5 text-xs font-medium text-foreground/80",
|
|
2708
|
-
children: [/* @__PURE__ */ Z(
|
|
2849
|
+
children: [/* @__PURE__ */ Z(We, { className: "size-3.5" }), fe]
|
|
2709
2850
|
}),
|
|
2710
2851
|
/* @__PURE__ */ Z("p", {
|
|
2711
2852
|
className: "text-xs text-muted-foreground",
|
|
2712
|
-
children:
|
|
2853
|
+
children: we
|
|
2713
2854
|
}),
|
|
2714
|
-
i ?
|
|
2855
|
+
i ? Bt.has(e.toolCallId) ? /* @__PURE__ */ Z("div", {
|
|
2715
2856
|
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
2716
2857
|
"data-testid": "proposed-plan-actions",
|
|
2717
2858
|
children: /* @__PURE__ */ Q("span", {
|
|
2718
2859
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-300",
|
|
2719
2860
|
"data-testid": "proposed-plan-built",
|
|
2720
|
-
children: [/* @__PURE__ */ Z(
|
|
2861
|
+
children: [/* @__PURE__ */ Z(G, { className: "size-3.5" }), Se]
|
|
2721
2862
|
})
|
|
2722
|
-
}) :
|
|
2863
|
+
}) : At.has(e.toolCallId) ? /* @__PURE__ */ Z("div", {
|
|
2723
2864
|
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
2724
2865
|
"data-testid": "proposed-plan-actions",
|
|
2725
2866
|
children: /* @__PURE__ */ Q("span", {
|
|
2726
2867
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md border bg-muted/40 px-3 text-xs font-medium text-muted-foreground",
|
|
2727
2868
|
"data-testid": "proposed-plan-building",
|
|
2728
|
-
children: [/* @__PURE__ */ Z(
|
|
2869
|
+
children: [/* @__PURE__ */ Z(it, { className: "size-3.5 animate-spin" }), Ce]
|
|
2729
2870
|
})
|
|
2730
2871
|
}) : /* @__PURE__ */ Q("div", {
|
|
2731
2872
|
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
2732
2873
|
"data-testid": "proposed-plan-actions",
|
|
2733
2874
|
children: [/* @__PURE__ */ Q("button", {
|
|
2734
2875
|
type: "button",
|
|
2735
|
-
onClick: () =>
|
|
2876
|
+
onClick: () => Nt(!1, e.toolCallId),
|
|
2736
2877
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
|
|
2737
2878
|
"data-testid": "proposed-plan-approve",
|
|
2738
|
-
children: [/* @__PURE__ */ Z(
|
|
2879
|
+
children: [/* @__PURE__ */ Z(dt, { className: "size-3.5" }), H]
|
|
2739
2880
|
}), /* @__PURE__ */ Z("button", {
|
|
2740
2881
|
type: "button",
|
|
2741
|
-
onClick:
|
|
2882
|
+
onClick: Rt,
|
|
2742
2883
|
className: "inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent",
|
|
2743
2884
|
"data-testid": "proposed-plan-adjust",
|
|
2744
|
-
children:
|
|
2885
|
+
children: U
|
|
2745
2886
|
})]
|
|
2746
2887
|
}) : /* @__PURE__ */ Z("span", {
|
|
2747
2888
|
className: "text-[11px] italic text-muted-foreground/80",
|
|
2748
|
-
children:
|
|
2889
|
+
children: xe
|
|
2749
2890
|
})
|
|
2750
2891
|
]
|
|
2751
2892
|
}) : null,
|
|
@@ -2755,7 +2896,7 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2755
2896
|
children: [
|
|
2756
2897
|
/* @__PURE__ */ Q("span", {
|
|
2757
2898
|
className: "inline-flex items-center gap-1.5 text-xs font-medium text-foreground/80",
|
|
2758
|
-
children: [/* @__PURE__ */ Z(
|
|
2899
|
+
children: [/* @__PURE__ */ Z(We, { className: "size-3.5" }), Oe]
|
|
2759
2900
|
}),
|
|
2760
2901
|
e.proposedChanges.summary ? /* @__PURE__ */ Z("p", {
|
|
2761
2902
|
className: "text-xs text-muted-foreground",
|
|
@@ -2765,66 +2906,111 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2765
2906
|
className: "flex flex-col gap-1",
|
|
2766
2907
|
children: e.proposedChanges.changes.map((e, t) => /* @__PURE__ */ Q("div", {
|
|
2767
2908
|
className: "flex items-start gap-1.5 rounded-md border bg-background px-2 py-1 text-[11px] text-foreground/80",
|
|
2768
|
-
children: [/* @__PURE__ */ Z(
|
|
2909
|
+
children: [/* @__PURE__ */ Z(gt, { className: "mt-px size-3 shrink-0 text-foreground/40" }), /* @__PURE__ */ Z("span", { children: ma(e, Pe) })]
|
|
2769
2910
|
}, t))
|
|
2770
2911
|
}),
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
"
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
"
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2912
|
+
(() => {
|
|
2913
|
+
let t = Ut.get(e.toolCallId);
|
|
2914
|
+
return t?.kind === "published" ? /* @__PURE__ */ Z("div", {
|
|
2915
|
+
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
2916
|
+
"data-testid": "proposed-changes-actions",
|
|
2917
|
+
children: /* @__PURE__ */ Q("span", {
|
|
2918
|
+
className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-300",
|
|
2919
|
+
"data-testid": "proposed-changes-applied",
|
|
2920
|
+
children: [/* @__PURE__ */ Z(G, { className: "size-3.5" }), Le]
|
|
2921
|
+
})
|
|
2922
|
+
}) : t?.kind === "failed" ? /* @__PURE__ */ Q("div", {
|
|
2923
|
+
className: "flex flex-col gap-1 pt-0.5",
|
|
2924
|
+
"data-testid": "proposed-changes-actions",
|
|
2925
|
+
children: [/* @__PURE__ */ Q("span", {
|
|
2926
|
+
className: "inline-flex h-7 w-fit items-center gap-1.5 rounded-md border border-red-200 bg-red-50 px-3 text-xs font-medium text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300",
|
|
2927
|
+
"data-testid": "proposed-changes-failed",
|
|
2928
|
+
children: [/* @__PURE__ */ Z(J, { className: "size-3.5" }), Be]
|
|
2929
|
+
}), t.error ? /* @__PURE__ */ Z("span", {
|
|
2930
|
+
className: "text-[11px] text-red-700/80 dark:text-red-300/80",
|
|
2931
|
+
"data-testid": "proposed-changes-failed-reason",
|
|
2932
|
+
children: t.error
|
|
2933
|
+
}) : null]
|
|
2934
|
+
}) : t?.kind === "drafted" ? /* @__PURE__ */ Q("div", {
|
|
2935
|
+
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
2936
|
+
"data-testid": "proposed-changes-actions",
|
|
2937
|
+
children: [/* @__PURE__ */ Q("span", {
|
|
2938
|
+
className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-amber-200 bg-amber-50 px-3 text-xs font-medium text-amber-800 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-300",
|
|
2939
|
+
"data-testid": "proposed-changes-drafted",
|
|
2940
|
+
children: [/* @__PURE__ */ Z(Ke, { className: "size-3.5" }), ze]
|
|
2941
|
+
}), L && t.packageId ? /* @__PURE__ */ Q("button", {
|
|
2942
|
+
type: "button",
|
|
2943
|
+
onClick: () => void Y(t.packageId),
|
|
2944
|
+
className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
|
|
2945
|
+
"data-testid": "proposed-changes-publish",
|
|
2946
|
+
children: [/* @__PURE__ */ Z(dt, { className: "size-3.5" }), ce]
|
|
2947
|
+
}) : null]
|
|
2948
|
+
}) : t?.kind === "applying" || Pt.has(e.toolCallId) ? /* @__PURE__ */ Z("div", {
|
|
2949
|
+
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
2950
|
+
"data-testid": "proposed-changes-actions",
|
|
2951
|
+
children: /* @__PURE__ */ Q("span", {
|
|
2952
|
+
className: "inline-flex h-7 items-center gap-1.5 rounded-md border bg-muted/40 px-3 text-xs font-medium text-foreground/70",
|
|
2953
|
+
"data-testid": "proposed-changes-applying",
|
|
2954
|
+
children: [/* @__PURE__ */ Z(it, { className: "size-3.5 animate-spin" }), Fe]
|
|
2955
|
+
})
|
|
2956
|
+
}) : i ? Ht.has(e.toolCallId) ? /* @__PURE__ */ Z("div", {
|
|
2957
|
+
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
2958
|
+
"data-testid": "proposed-changes-actions",
|
|
2959
|
+
children: /* @__PURE__ */ Q("span", {
|
|
2960
|
+
className: "inline-flex h-7 items-center gap-1.5 rounded-md border border-emerald-200 bg-emerald-50 px-3 text-xs font-medium text-emerald-700 dark:border-emerald-900/50 dark:bg-emerald-950/30 dark:text-emerald-300",
|
|
2961
|
+
"data-testid": "proposed-changes-confirmed",
|
|
2962
|
+
children: [/* @__PURE__ */ Z(G, { className: "size-3.5" }), ke]
|
|
2963
|
+
})
|
|
2964
|
+
}) : /* @__PURE__ */ Q("div", {
|
|
2965
|
+
className: "flex flex-wrap items-center gap-1.5 pt-0.5",
|
|
2966
|
+
"data-testid": "proposed-changes-actions",
|
|
2967
|
+
children: [/* @__PURE__ */ Q("button", {
|
|
2968
|
+
type: "button",
|
|
2969
|
+
onClick: () => Lt(e.toolCallId),
|
|
2970
|
+
className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
|
|
2971
|
+
"data-testid": "proposed-changes-confirm",
|
|
2972
|
+
children: [/* @__PURE__ */ Z(G, { className: "size-3.5" }), Ae]
|
|
2973
|
+
}), /* @__PURE__ */ Z("button", {
|
|
2974
|
+
type: "button",
|
|
2975
|
+
onClick: Rt,
|
|
2976
|
+
className: "inline-flex h-7 items-center rounded-md border bg-background px-3 text-xs font-medium hover:bg-accent",
|
|
2977
|
+
"data-testid": "proposed-changes-adjust",
|
|
2978
|
+
children: U
|
|
2979
|
+
})]
|
|
2980
|
+
}) : /* @__PURE__ */ Z("span", {
|
|
2981
|
+
className: "text-[11px] italic text-muted-foreground/80",
|
|
2982
|
+
children: je
|
|
2983
|
+
});
|
|
2984
|
+
})()
|
|
2799
2985
|
]
|
|
2800
2986
|
}) : null
|
|
2801
2987
|
] })]
|
|
2802
2988
|
}, e.toolCallId);
|
|
2803
2989
|
};
|
|
2804
2990
|
return /* @__PURE__ */ Q("div", {
|
|
2805
|
-
ref:
|
|
2806
|
-
className:
|
|
2991
|
+
ref: Ye,
|
|
2992
|
+
className: W(nt ? "flex min-h-0 flex-col overflow-hidden bg-background" : "flex min-h-0 flex-col overflow-hidden rounded-lg border bg-background", t),
|
|
2807
2993
|
style: { maxHeight: b },
|
|
2808
|
-
...
|
|
2994
|
+
...qe,
|
|
2809
2995
|
children: [
|
|
2810
2996
|
a && !y && n.length > 0 && /* @__PURE__ */ Z("div", {
|
|
2811
|
-
className:
|
|
2997
|
+
className: W("flex items-center justify-end px-4 py-2", nt ? "bg-background" : "border-b bg-muted/30"),
|
|
2812
2998
|
children: /* @__PURE__ */ Z("button", {
|
|
2813
2999
|
type: "button",
|
|
2814
3000
|
onClick: a,
|
|
2815
3001
|
className: "text-xs text-muted-foreground hover:text-foreground transition-colors",
|
|
2816
|
-
children:
|
|
3002
|
+
children: q.clear
|
|
2817
3003
|
})
|
|
2818
3004
|
}),
|
|
2819
3005
|
A ? /* @__PURE__ */ Z("div", {
|
|
2820
|
-
className:
|
|
3006
|
+
className: W("shrink-0", !nt && "border-b bg-background/50"),
|
|
2821
3007
|
children: A
|
|
2822
3008
|
}) : null,
|
|
2823
|
-
/* @__PURE__ */ Q(
|
|
3009
|
+
/* @__PURE__ */ Q(gr, {
|
|
2824
3010
|
className: "flex-1 min-h-0",
|
|
2825
|
-
children: [/* @__PURE__ */ Q(
|
|
2826
|
-
className:
|
|
2827
|
-
children: [n.length === 0 ? /* @__PURE__ */ Q(
|
|
3011
|
+
children: [/* @__PURE__ */ Q(_r, {
|
|
3012
|
+
className: W("space-y-4", nt ? "mx-auto w-full max-w-2xl px-4 py-8 sm:px-0" : "px-4 py-3"),
|
|
3013
|
+
children: [n.length === 0 ? /* @__PURE__ */ Q(vr, {
|
|
2828
3014
|
className: "gap-3 px-0 py-8",
|
|
2829
3015
|
children: [
|
|
2830
3016
|
/* @__PURE__ */ Z("div", {
|
|
@@ -2833,49 +3019,49 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2833
3019
|
src: _,
|
|
2834
3020
|
alt: "",
|
|
2835
3021
|
className: "size-full rounded-md object-cover"
|
|
2836
|
-
}) : /* @__PURE__ */ Z(
|
|
3022
|
+
}) : /* @__PURE__ */ Z(Ie, { className: "size-4" })
|
|
2837
3023
|
}),
|
|
2838
3024
|
/* @__PURE__ */ Q("div", {
|
|
2839
3025
|
className: "w-full max-w-full space-y-1",
|
|
2840
3026
|
children: [/* @__PURE__ */ Z("h3", {
|
|
2841
3027
|
className: "text-sm font-medium text-foreground/90 break-words",
|
|
2842
|
-
children:
|
|
3028
|
+
children: q.emptyTitle
|
|
2843
3029
|
}), /* @__PURE__ */ Z("p", {
|
|
2844
3030
|
className: "text-sm text-muted-foreground break-words",
|
|
2845
|
-
children:
|
|
3031
|
+
children: q.emptyDescription
|
|
2846
3032
|
})]
|
|
2847
3033
|
}),
|
|
2848
3034
|
T && T.length > 0 ? /* @__PURE__ */ Z("div", {
|
|
2849
3035
|
className: "flex w-full max-w-full flex-wrap justify-center gap-2",
|
|
2850
|
-
children: T.map((e) => /* @__PURE__ */ Z(
|
|
3036
|
+
children: T.map((e) => /* @__PURE__ */ Z(Li, {
|
|
2851
3037
|
className: "h-auto min-h-8 min-w-0 max-w-full whitespace-normal break-words rounded-full border-border/60 bg-background/80 px-3 py-1 text-left text-xs font-medium text-foreground/90 shadow-none hover:bg-muted/60",
|
|
2852
3038
|
suggestion: e,
|
|
2853
|
-
onClick:
|
|
3039
|
+
onClick: Ot
|
|
2854
3040
|
}, e))
|
|
2855
3041
|
}) : null
|
|
2856
3042
|
]
|
|
2857
3043
|
}) : n.map((e) => {
|
|
2858
|
-
let t = e.role === "user", n = e.toolInvocations ?? [], r = e.reasoning?.trim(), i = e.sources ?? [], a = t ? void 0 : e.buildProgress, o = !t && !n.some((e) => !!e.proposedPlan) ? e.blueprintProgress : void 0, c = !t &&
|
|
2859
|
-
return /* @__PURE__ */ Z(
|
|
2860
|
-
from:
|
|
3044
|
+
let t = e.role === "user", n = e.toolInvocations ?? [], r = e.reasoning?.trim(), i = e.sources ?? [], a = t ? void 0 : e.buildProgress, o = !t && !n.some((e) => !!e.proposedPlan) ? e.blueprintProgress : void 0, c = !t && K === "summary" ? n.filter((e) => !ya(e) && !(o && e.toolName === "propose_blueprint")) : [], l = !t && K === "debug" ? n : !t && K !== "debug" ? n.filter(ya) : [], u = !t && e.content.trim().length > 0 && !xa(e.content), d = K === "debug" && !!r, f = !t && !!e.streaming && !u && c.length === 0 && l.length === 0 && !d && !a && !o;
|
|
3045
|
+
return /* @__PURE__ */ Z(Cr, {
|
|
3046
|
+
from: la(e.role),
|
|
2861
3047
|
children: /* @__PURE__ */ Q("div", {
|
|
2862
|
-
className:
|
|
2863
|
-
children: [m ? /* @__PURE__ */ Z(
|
|
3048
|
+
className: W("flex w-full gap-2.5", m ? t ? "flex-row-reverse items-start" : "flex-row items-start" : "flex-col"),
|
|
3049
|
+
children: [m ? /* @__PURE__ */ Z(Ta, {
|
|
2864
3050
|
isUser: t,
|
|
2865
3051
|
url: t ? h : _,
|
|
2866
3052
|
fallback: t ? g : v
|
|
2867
3053
|
}) : null, /* @__PURE__ */ Q("div", {
|
|
2868
|
-
className:
|
|
2869
|
-
children: [/* @__PURE__ */ Q(
|
|
2870
|
-
o ? /* @__PURE__ */ Z(
|
|
3054
|
+
className: W("flex min-w-0 flex-col gap-2", m && !t && "flex-1"),
|
|
3055
|
+
children: [/* @__PURE__ */ Q(wr, { children: [
|
|
3056
|
+
o ? /* @__PURE__ */ Z(Ba, {
|
|
2871
3057
|
progress: o,
|
|
2872
|
-
designingLabel:
|
|
2873
|
-
extendLabel:
|
|
2874
|
-
waitingLabel:
|
|
2875
|
-
stalledLabel:
|
|
2876
|
-
offlineLabel:
|
|
3058
|
+
designingLabel: q.designingPlanLabel,
|
|
3059
|
+
extendLabel: _e,
|
|
3060
|
+
waitingLabel: q.connectionWaiting,
|
|
3061
|
+
stalledLabel: q.connectionStalledLabel,
|
|
3062
|
+
offlineLabel: q.connectionOfflineLabel
|
|
2877
3063
|
}) : null,
|
|
2878
|
-
a ? /* @__PURE__ */ Z(
|
|
3064
|
+
a ? /* @__PURE__ */ Z(Va, {
|
|
2879
3065
|
progress: a,
|
|
2880
3066
|
appSegment: e.toolInvocations?.map((e) => e.draftReview).find((e) => e?.packageId && e.items?.some((e) => e.type === "app"))?.packageId,
|
|
2881
3067
|
onOpenBuiltApp: re,
|
|
@@ -2885,27 +3071,27 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2885
3071
|
getArtifactAction: oe,
|
|
2886
3072
|
onPreviewDraftApp: z,
|
|
2887
3073
|
previewDraftLabel: B,
|
|
2888
|
-
waitingLabel:
|
|
2889
|
-
stalledLabel:
|
|
2890
|
-
offlineLabel:
|
|
3074
|
+
waitingLabel: q.connectionWaiting,
|
|
3075
|
+
stalledLabel: q.connectionStalledLabel,
|
|
3076
|
+
offlineLabel: q.connectionOfflineLabel
|
|
2891
3077
|
}) : null,
|
|
2892
|
-
!t &&
|
|
3078
|
+
!t && K === "debug" && r ? /* @__PURE__ */ Q(ea, {
|
|
2893
3079
|
isStreaming: !!e.streaming && !e.content,
|
|
2894
3080
|
className: "mb-2",
|
|
2895
|
-
children: [/* @__PURE__ */ Z(
|
|
3081
|
+
children: [/* @__PURE__ */ Z(na, {}), /* @__PURE__ */ Z(ra, { children: r })]
|
|
2896
3082
|
}) : null,
|
|
2897
|
-
!t &&
|
|
2898
|
-
groups:
|
|
2899
|
-
labels:
|
|
3083
|
+
!t && K === "summary" && c.length > 0 ? /* @__PURE__ */ Z(Ha, {
|
|
3084
|
+
groups: Sa(c),
|
|
3085
|
+
labels: q
|
|
2900
3086
|
}) : null,
|
|
2901
|
-
!t && l.length > 0 ? l.map(
|
|
3087
|
+
!t && l.length > 0 ? l.map(Wt) : null,
|
|
2902
3088
|
t ? e.content ? /* @__PURE__ */ Z("div", {
|
|
2903
3089
|
className: "whitespace-pre-wrap break-words",
|
|
2904
3090
|
children: e.content
|
|
2905
|
-
}) : null : f ? /* @__PURE__ */ Z(
|
|
3091
|
+
}) : null : f ? /* @__PURE__ */ Z(Da, {}) : u ? /* @__PURE__ */ Z(Fr, { children: e.content }) : !e.streaming && xa(e.content) ? /* @__PURE__ */ Z("span", {
|
|
2906
3092
|
className: "text-xs italic text-muted-foreground/70",
|
|
2907
3093
|
title: e.content,
|
|
2908
|
-
children:
|
|
3094
|
+
children: q.agentActivity
|
|
2909
3095
|
}) : null,
|
|
2910
3096
|
e.streaming && u ? /* @__PURE__ */ Z("span", {
|
|
2911
3097
|
"aria-hidden": !0,
|
|
@@ -2930,7 +3116,7 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2930
3116
|
} })]
|
|
2931
3117
|
}, t))
|
|
2932
3118
|
}) : null,
|
|
2933
|
-
!t && i.length > 0 ? /* @__PURE__ */ Q(
|
|
3119
|
+
!t && i.length > 0 ? /* @__PURE__ */ Q(ia, { children: [/* @__PURE__ */ Z(aa, { count: i.length }), /* @__PURE__ */ Z(oa, { children: i.map((e, t) => /* @__PURE__ */ Z(sa, {
|
|
2934
3120
|
href: e.url,
|
|
2935
3121
|
title: e.title ?? e.url
|
|
2936
3122
|
}, e.id ?? e.url ?? t)) })] }) : null,
|
|
@@ -2938,133 +3124,144 @@ var ua = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
2938
3124
|
className: "text-[10px] opacity-70 mt-1",
|
|
2939
3125
|
children: e.timestamp
|
|
2940
3126
|
}) : null
|
|
2941
|
-
] }), !t && !f ? /* @__PURE__ */ Q(
|
|
3127
|
+
] }), !t && !f ? /* @__PURE__ */ Q(Tr, {
|
|
2942
3128
|
className: "opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",
|
|
2943
3129
|
children: [
|
|
2944
|
-
/* @__PURE__ */ Z(
|
|
2945
|
-
label:
|
|
2946
|
-
tooltip:
|
|
2947
|
-
onClick: () =>
|
|
2948
|
-
children:
|
|
3130
|
+
/* @__PURE__ */ Z(Er, {
|
|
3131
|
+
label: rt === e.id ? q.copied : q.copy,
|
|
3132
|
+
tooltip: rt === e.id ? q.copied : q.copy,
|
|
3133
|
+
onClick: () => zt(e),
|
|
3134
|
+
children: rt === e.id ? /* @__PURE__ */ Z(Re, { className: "size-3.5" }) : /* @__PURE__ */ Z(Je, { className: "size-3.5" })
|
|
2949
3135
|
}),
|
|
2950
|
-
s ? /* @__PURE__ */ Z(
|
|
2951
|
-
label:
|
|
2952
|
-
tooltip:
|
|
3136
|
+
s ? /* @__PURE__ */ Z(Er, {
|
|
3137
|
+
label: q.regenerate,
|
|
3138
|
+
tooltip: q.regenerate,
|
|
2953
3139
|
onClick: s,
|
|
2954
|
-
children: /* @__PURE__ */ Z(
|
|
3140
|
+
children: /* @__PURE__ */ Z(ut, { className: "size-3.5" })
|
|
2955
3141
|
}) : null,
|
|
2956
|
-
|
|
3142
|
+
K === "debug" && e.traceId ? /* @__PURE__ */ Z("a", {
|
|
2957
3143
|
href: `#trace/${e.traceId}`,
|
|
2958
3144
|
"data-trace-id": e.traceId,
|
|
2959
3145
|
className: "text-[10px] text-muted-foreground hover:text-foreground ml-1 underline",
|
|
2960
|
-
title:
|
|
2961
|
-
children:
|
|
3146
|
+
title: q.viewTrace,
|
|
3147
|
+
children: q.trace
|
|
2962
3148
|
}) : null
|
|
2963
3149
|
]
|
|
2964
3150
|
}) : null]
|
|
2965
3151
|
})]
|
|
2966
3152
|
})
|
|
2967
3153
|
}, e.id);
|
|
2968
|
-
}), d && !n.some((e) => e.streaming) ? /* @__PURE__ */ Z(
|
|
3154
|
+
}), d && !n.some((e) => e.streaming) ? /* @__PURE__ */ Z(Ea, {
|
|
2969
3155
|
showAvatar: m,
|
|
2970
3156
|
assistantAvatarUrl: _,
|
|
2971
3157
|
assistantAvatarFallback: v,
|
|
2972
|
-
waitingLabel:
|
|
2973
|
-
stalledLabel:
|
|
2974
|
-
offlineLabel:
|
|
3158
|
+
waitingLabel: q.connectionWaiting,
|
|
3159
|
+
stalledLabel: q.connectionStalledLabel,
|
|
3160
|
+
offlineLabel: q.connectionOfflineLabel
|
|
2975
3161
|
}) : null]
|
|
2976
|
-
}), /* @__PURE__ */ Z(
|
|
3162
|
+
}), /* @__PURE__ */ Z(yr, {})]
|
|
2977
3163
|
}),
|
|
2978
|
-
f ?
|
|
3164
|
+
f ? pr(f) && !fr(f) ? /* @__PURE__ */ Z(Ga, {
|
|
2979
3165
|
error: f,
|
|
2980
|
-
rateLimitedLabel:
|
|
2981
|
-
genericLabel:
|
|
2982
|
-
}) : /* @__PURE__ */ Z(
|
|
3166
|
+
rateLimitedLabel: q.sendFailedRateLimited,
|
|
3167
|
+
genericLabel: q.sendFailedGeneric
|
|
3168
|
+
}) : /* @__PURE__ */ Z(Ka, {
|
|
2983
3169
|
error: f,
|
|
2984
3170
|
onReload: s,
|
|
2985
3171
|
onUpgrade: c
|
|
2986
3172
|
}) : null,
|
|
2987
3173
|
u ? null : /* @__PURE__ */ Q("div", {
|
|
2988
|
-
ref:
|
|
2989
|
-
className:
|
|
2990
|
-
children: [
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
className: "
|
|
3025
|
-
children:
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3174
|
+
ref: kt,
|
|
3175
|
+
className: W("relative", nt && "mx-auto w-full max-w-2xl px-4 pb-4 sm:px-0"),
|
|
3176
|
+
children: [
|
|
3177
|
+
Ve ? /* @__PURE__ */ Z("div", {
|
|
3178
|
+
className: "mb-1 flex",
|
|
3179
|
+
"data-testid": "surface-context-chip",
|
|
3180
|
+
children: /* @__PURE__ */ Z("span", {
|
|
3181
|
+
className: "inline-flex items-center gap-1 rounded-full border bg-muted/40 px-2 py-0.5 text-[11px] text-muted-foreground",
|
|
3182
|
+
children: Ve
|
|
3183
|
+
})
|
|
3184
|
+
}) : null,
|
|
3185
|
+
j ? /* @__PURE__ */ Z("div", {
|
|
3186
|
+
className: "absolute bottom-full left-0 right-0 z-10 px-3 pb-1",
|
|
3187
|
+
children: j
|
|
3188
|
+
}) : null,
|
|
3189
|
+
/* @__PURE__ */ Q(ri, {
|
|
3190
|
+
accept: C,
|
|
3191
|
+
fileInputLabel: q.uploadFiles,
|
|
3192
|
+
maxFileSize: w,
|
|
3193
|
+
onSubmit: Dt,
|
|
3194
|
+
onError: (e) => {
|
|
3195
|
+
console.warn("[plugin-chatbot] prompt-input error", e);
|
|
3196
|
+
},
|
|
3197
|
+
children: [
|
|
3198
|
+
S ? /* @__PURE__ */ Z(ii, { children: /* @__PURE__ */ Z(ti, { children: (e) => /* @__PURE__ */ Z(ei, { data: e }) }) }) : null,
|
|
3199
|
+
/* @__PURE__ */ Z(ai, {
|
|
3200
|
+
placeholder: r,
|
|
3201
|
+
disabled: l || Ze === "streaming",
|
|
3202
|
+
onChange: M ? (e) => M(e.currentTarget.value) : void 0
|
|
3203
|
+
}),
|
|
3204
|
+
/* @__PURE__ */ Q(si, { children: [/* @__PURE__ */ Q(ci, { children: [
|
|
3205
|
+
S ? /* @__PURE__ */ Q(ui, { children: [/* @__PURE__ */ Z(di, {}), /* @__PURE__ */ Z(fi, { children: /* @__PURE__ */ Z(ni, {}) })] }) : null,
|
|
3206
|
+
D && D.length > 1 ? /* @__PURE__ */ Z("select", {
|
|
3207
|
+
"aria-label": q.model,
|
|
3208
|
+
value: O ?? D[0].id,
|
|
3209
|
+
onChange: (e) => k?.(e.target.value),
|
|
3210
|
+
className: "h-7 rounded-md border bg-background px-2 text-xs text-muted-foreground hover:text-foreground focus:outline-none focus:ring-1 focus:ring-ring",
|
|
3211
|
+
children: D.map((e) => /* @__PURE__ */ Q("option", {
|
|
3212
|
+
value: e.id,
|
|
3213
|
+
children: [e.label ?? e.id, e.provider ? ` · ${e.provider}` : ""]
|
|
3214
|
+
}, e.id))
|
|
3215
|
+
}) : null,
|
|
3216
|
+
/* @__PURE__ */ Q("span", {
|
|
3217
|
+
className: "hidden items-center gap-1 text-[10px] text-muted-foreground sm:inline-flex",
|
|
3218
|
+
"aria-hidden": "true",
|
|
3219
|
+
children: [/* @__PURE__ */ Z(Xe, { className: "h-3 w-3" }), /* @__PURE__ */ Z("span", {
|
|
3220
|
+
className: "opacity-70",
|
|
3221
|
+
children: q.sendHint
|
|
3222
|
+
})]
|
|
3223
|
+
})
|
|
3224
|
+
] }), /* @__PURE__ */ Z(mi, {
|
|
3225
|
+
"aria-label": Ze === "streaming" ? q.stopResponse : q.submit,
|
|
3226
|
+
status: Ze,
|
|
3227
|
+
disabled: l,
|
|
3228
|
+
onClick: Ze === "streaming" ? o : void 0,
|
|
3229
|
+
type: Ze === "streaming" ? "button" : "submit"
|
|
3230
|
+
})] })
|
|
3231
|
+
]
|
|
3232
|
+
})
|
|
3233
|
+
]
|
|
3037
3234
|
})
|
|
3038
3235
|
]
|
|
3039
3236
|
});
|
|
3040
3237
|
});
|
|
3041
|
-
|
|
3042
|
-
function
|
|
3238
|
+
wa.displayName = "ChatbotEnhanced";
|
|
3239
|
+
function Ta({ isUser: e, url: t, fallback: n }) {
|
|
3043
3240
|
return /* @__PURE__ */ Z("div", {
|
|
3044
|
-
className:
|
|
3241
|
+
className: W("mt-0.5 flex size-7 shrink-0 items-center justify-center overflow-hidden rounded-full text-[11px] font-medium", e ? "bg-secondary text-secondary-foreground" : "bg-primary/10 text-primary"),
|
|
3045
3242
|
"aria-hidden": "true",
|
|
3046
3243
|
children: t ? /* @__PURE__ */ Z("img", {
|
|
3047
3244
|
src: t,
|
|
3048
3245
|
alt: "",
|
|
3049
3246
|
className: "size-full object-cover"
|
|
3050
|
-
}) : e ? n?.trim()?.charAt(0)?.toUpperCase() || "U" : /* @__PURE__ */ Z(
|
|
3247
|
+
}) : e ? n?.trim()?.charAt(0)?.toUpperCase() || "U" : /* @__PURE__ */ Z(Ie, { className: "size-4" })
|
|
3051
3248
|
});
|
|
3052
3249
|
}
|
|
3053
|
-
function
|
|
3054
|
-
return /* @__PURE__ */ Z(
|
|
3250
|
+
function Ea({ showAvatar: e, assistantAvatarUrl: t, assistantAvatarFallback: n, waitingLabel: r, stalledLabel: i, offlineLabel: a }) {
|
|
3251
|
+
return /* @__PURE__ */ Z(Cr, {
|
|
3055
3252
|
from: "assistant",
|
|
3056
3253
|
"aria-live": "polite",
|
|
3057
3254
|
children: /* @__PURE__ */ Q("div", {
|
|
3058
|
-
className:
|
|
3059
|
-
children: [e ? /* @__PURE__ */ Z(
|
|
3255
|
+
className: W("flex w-full gap-2.5", e ? "flex-row items-start" : "flex-col"),
|
|
3256
|
+
children: [e ? /* @__PURE__ */ Z(Ta, {
|
|
3060
3257
|
isUser: !1,
|
|
3061
3258
|
url: t,
|
|
3062
3259
|
fallback: n
|
|
3063
|
-
}) : null, /* @__PURE__ */ Z(
|
|
3260
|
+
}) : null, /* @__PURE__ */ Z(wr, {
|
|
3064
3261
|
className: "rounded-lg border bg-muted/30 px-3 py-2 text-muted-foreground",
|
|
3065
3262
|
children: /* @__PURE__ */ Q("span", {
|
|
3066
3263
|
className: "inline-flex items-center gap-2",
|
|
3067
|
-
children: [/* @__PURE__ */ Z(
|
|
3264
|
+
children: [/* @__PURE__ */ Z(Da, {}), /* @__PURE__ */ Z(Ma, {
|
|
3068
3265
|
active: !0,
|
|
3069
3266
|
pending: !0,
|
|
3070
3267
|
activityKey: 0,
|
|
@@ -3077,7 +3274,7 @@ function fa({ showAvatar: e, assistantAvatarUrl: t, assistantAvatarFallback: n,
|
|
|
3077
3274
|
})
|
|
3078
3275
|
});
|
|
3079
3276
|
}
|
|
3080
|
-
function
|
|
3277
|
+
function Da() {
|
|
3081
3278
|
return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("span", {
|
|
3082
3279
|
className: "sr-only",
|
|
3083
3280
|
children: "Assistant is responding"
|
|
@@ -3091,12 +3288,12 @@ function pa() {
|
|
|
3091
3288
|
]
|
|
3092
3289
|
})] });
|
|
3093
3290
|
}
|
|
3094
|
-
function
|
|
3291
|
+
function Oa(e) {
|
|
3095
3292
|
let t = Math.floor(e / 60), n = e % 60;
|
|
3096
3293
|
return `${t}:${String(n).padStart(2, "0")}`;
|
|
3097
3294
|
}
|
|
3098
|
-
var
|
|
3099
|
-
function
|
|
3295
|
+
var ka = 6;
|
|
3296
|
+
function Aa(t, n) {
|
|
3100
3297
|
let r = e.useRef(0), i = e.useRef(0), [a, o] = e.useState({
|
|
3101
3298
|
elapsed: 0,
|
|
3102
3299
|
quiet: 0
|
|
@@ -3125,10 +3322,10 @@ function ga(t, n) {
|
|
|
3125
3322
|
}, [t]), {
|
|
3126
3323
|
elapsedSeconds: a.elapsed,
|
|
3127
3324
|
quietSeconds: a.quiet,
|
|
3128
|
-
live: a.quiet <
|
|
3325
|
+
live: a.quiet < ka
|
|
3129
3326
|
};
|
|
3130
3327
|
}
|
|
3131
|
-
function
|
|
3328
|
+
function ja() {
|
|
3132
3329
|
let [t, n] = e.useState(() => typeof navigator < "u" && navigator.onLine === !1);
|
|
3133
3330
|
return e.useEffect(() => {
|
|
3134
3331
|
if (typeof window > "u") return;
|
|
@@ -3138,22 +3335,22 @@ function _a() {
|
|
|
3138
3335
|
};
|
|
3139
3336
|
}, []), t;
|
|
3140
3337
|
}
|
|
3141
|
-
function
|
|
3142
|
-
let { elapsedSeconds: o, quietSeconds: s, live: c } =
|
|
3338
|
+
function Ma({ active: e, activityKey: t, pending: n = !1, waitingLabel: r, stalledLabel: i = "Still working…", offlineLabel: a = "Connection lost — reconnecting…" }) {
|
|
3339
|
+
let { elapsedSeconds: o, quietSeconds: s, live: c } = Aa(e, t), l = ja() ? "offline" : c ? n ? "waiting" : "receiving" : "stalled", u = Oa(o);
|
|
3143
3340
|
return /* @__PURE__ */ Q("span", {
|
|
3144
|
-
className:
|
|
3341
|
+
className: W("inline-flex items-center gap-1.5 text-xs tabular-nums", l === "offline" ? "text-red-600 font-medium" : l === "stalled" ? "text-amber-600 font-medium" : "font-normal text-muted-foreground"),
|
|
3145
3342
|
"aria-live": "polite",
|
|
3146
3343
|
"data-liveness-tier": l,
|
|
3147
3344
|
title: l === "offline" ? `${a} · ${u} elapsed` : l === "receiving" ? `Receiving from server · ${u} elapsed` : l === "stalled" ? `${i} (${s}s with no response) · ${u} elapsed` : `${r} · ${u} elapsed`,
|
|
3148
3345
|
children: [
|
|
3149
|
-
l === "offline" ? /* @__PURE__ */ Z(
|
|
3346
|
+
l === "offline" ? /* @__PURE__ */ Z(vt, {
|
|
3150
3347
|
className: "size-3 shrink-0",
|
|
3151
3348
|
"aria-hidden": !0
|
|
3152
3349
|
}) : /* @__PURE__ */ Z("span", {
|
|
3153
3350
|
"aria-hidden": !0,
|
|
3154
|
-
className:
|
|
3351
|
+
className: W("size-1.5 shrink-0 rounded-full", l === "receiving" ? "bg-emerald-500 animate-pulse" : l === "stalled" ? "bg-amber-500" : "bg-muted-foreground/50 animate-pulse")
|
|
3155
3352
|
}),
|
|
3156
|
-
/* @__PURE__ */ Z(
|
|
3353
|
+
/* @__PURE__ */ Z(Ke, {
|
|
3157
3354
|
className: "size-3 shrink-0",
|
|
3158
3355
|
"aria-hidden": !0
|
|
3159
3356
|
}),
|
|
@@ -3162,7 +3359,7 @@ function va({ active: e, activityKey: t, pending: n = !1, waitingLabel: r, stall
|
|
|
3162
3359
|
]
|
|
3163
3360
|
});
|
|
3164
3361
|
}
|
|
3165
|
-
var
|
|
3362
|
+
var Na = [
|
|
3166
3363
|
"Mapping out the data you’ll track…",
|
|
3167
3364
|
"Shaping objects and their fields…",
|
|
3168
3365
|
"Connecting related records…",
|
|
@@ -3173,27 +3370,27 @@ var ya = [
|
|
|
3173
3370
|
"Sketching a dashboard to track it…",
|
|
3174
3371
|
"Double-checking the structure hangs together…",
|
|
3175
3372
|
"Pulling the plan together…"
|
|
3176
|
-
],
|
|
3177
|
-
function
|
|
3373
|
+
], Pa = 3500;
|
|
3374
|
+
function Fa(e, t, n = Pa) {
|
|
3178
3375
|
if (t <= 0) return -1;
|
|
3179
3376
|
if (t === 1) return 0;
|
|
3180
|
-
let r = Math.floor((Number.isFinite(e) && e > 0 ? e : 0) / (n > 0 ? n :
|
|
3377
|
+
let r = Math.floor((Number.isFinite(e) && e > 0 ? e : 0) / (n > 0 ? n : Pa));
|
|
3181
3378
|
return Math.min(r, t - 1);
|
|
3182
3379
|
}
|
|
3183
|
-
function
|
|
3380
|
+
function Ia({ label: t, hints: n, offlineLabel: r }) {
|
|
3184
3381
|
let [i, a] = e.useState(0);
|
|
3185
3382
|
e.useEffect(() => {
|
|
3186
3383
|
if (n.length <= 1) return;
|
|
3187
|
-
let e = Date.now(), t = setInterval(() => a(Date.now() - e),
|
|
3384
|
+
let e = Date.now(), t = setInterval(() => a(Date.now() - e), Pa);
|
|
3188
3385
|
return () => clearInterval(t);
|
|
3189
3386
|
}, [n.length]);
|
|
3190
|
-
let o =
|
|
3387
|
+
let o = Fa(i, n.length), s = o >= 0 ? n[o] : void 0, c = n.length > 1 && n.length <= 12;
|
|
3191
3388
|
return /* @__PURE__ */ Q("span", {
|
|
3192
3389
|
className: "inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",
|
|
3193
3390
|
"data-testid": "build-proposal-progress",
|
|
3194
3391
|
"aria-live": "polite",
|
|
3195
3392
|
children: [
|
|
3196
|
-
/* @__PURE__ */ Z(
|
|
3393
|
+
/* @__PURE__ */ Z(mt, {
|
|
3197
3394
|
className: "size-3 shrink-0 animate-pulse text-primary",
|
|
3198
3395
|
"aria-hidden": !0
|
|
3199
3396
|
}),
|
|
@@ -3209,45 +3406,45 @@ function Sa({ label: t, hints: n, offlineLabel: r }) {
|
|
|
3209
3406
|
className: "hidden shrink-0 items-center gap-0.5 sm:inline-flex",
|
|
3210
3407
|
"data-testid": "build-proposal-progress-dots",
|
|
3211
3408
|
"aria-hidden": !0,
|
|
3212
|
-
children: n.map((e, t) => /* @__PURE__ */ Z("span", { className:
|
|
3409
|
+
children: n.map((e, t) => /* @__PURE__ */ Z("span", { className: W("size-1 rounded-full transition-colors", t <= o ? "bg-primary/70" : "bg-muted-foreground/25") }, t))
|
|
3213
3410
|
}) : null,
|
|
3214
|
-
/* @__PURE__ */ Z(
|
|
3411
|
+
/* @__PURE__ */ Z(La, { offlineLabel: r })
|
|
3215
3412
|
]
|
|
3216
3413
|
});
|
|
3217
3414
|
}
|
|
3218
|
-
function
|
|
3219
|
-
let [n, r] = e.useState(0), i =
|
|
3415
|
+
function La({ offlineLabel: t }) {
|
|
3416
|
+
let [n, r] = e.useState(0), i = ja();
|
|
3220
3417
|
return e.useEffect(() => {
|
|
3221
3418
|
let e = Date.now(), t = setInterval(() => r(Math.floor((Date.now() - e) / 1e3)), 1e3);
|
|
3222
3419
|
return () => clearInterval(t);
|
|
3223
3420
|
}, []), /* @__PURE__ */ Q("span", {
|
|
3224
|
-
className:
|
|
3421
|
+
className: W("inline-flex items-center gap-1 text-xs tabular-nums", i ? "text-red-600 font-medium" : "text-muted-foreground"),
|
|
3225
3422
|
"aria-live": "polite",
|
|
3226
3423
|
"data-tool-running-timer": !0,
|
|
3227
3424
|
children: [
|
|
3228
|
-
Z(i ?
|
|
3425
|
+
Z(i ? vt : Ke, {
|
|
3229
3426
|
className: "size-3 shrink-0",
|
|
3230
3427
|
"aria-hidden": !0
|
|
3231
3428
|
}),
|
|
3232
|
-
/* @__PURE__ */ Z("span", { children:
|
|
3429
|
+
/* @__PURE__ */ Z("span", { children: Oa(n) }),
|
|
3233
3430
|
i ? /* @__PURE__ */ Q("span", { children: ["· ", t] }) : null
|
|
3234
3431
|
]
|
|
3235
3432
|
});
|
|
3236
3433
|
}
|
|
3237
|
-
var
|
|
3434
|
+
var Ra = [
|
|
3238
3435
|
"object",
|
|
3239
3436
|
"view",
|
|
3240
3437
|
"dashboard",
|
|
3241
3438
|
"app",
|
|
3242
3439
|
"seed"
|
|
3243
|
-
],
|
|
3440
|
+
], za = {
|
|
3244
3441
|
object: "Objects",
|
|
3245
3442
|
view: "Views",
|
|
3246
3443
|
dashboard: "Dashboards",
|
|
3247
3444
|
app: "App",
|
|
3248
3445
|
seed: "Sample data"
|
|
3249
3446
|
};
|
|
3250
|
-
function
|
|
3447
|
+
function Ba({ progress: e, designingLabel: t = "Designing your app…", extendLabel: n = "Adding to existing app", waitingLabel: r = "Waiting for server…", stalledLabel: i = "Still working…", offlineLabel: a = "Connection lost — reconnecting…" }) {
|
|
3251
3448
|
let { phase: o, summary: s, appLabel: c, targetApp: l, objects: u, counts: d, seq: f } = e, p = o === "done", m = f ?? `${o}:${u.length}`, h = p && (s || c) || t, g = [];
|
|
3252
3449
|
return d?.objects && g.push(`${d.objects} object${d.objects === 1 ? "" : "s"}`), d?.views && g.push(`${d.views} view${d.views === 1 ? "" : "s"}`), d?.dashboards && g.push(`${d.dashboards} dashboard${d.dashboards === 1 ? "" : "s"}`), /* @__PURE__ */ Q("div", {
|
|
3253
3450
|
className: "rounded-lg border bg-muted/30 p-3 text-sm",
|
|
@@ -3256,7 +3453,7 @@ function Ea({ progress: e, designingLabel: t = "Designing your app…", extendLa
|
|
|
3256
3453
|
/* @__PURE__ */ Q("div", {
|
|
3257
3454
|
className: "mb-2 flex items-center gap-2 font-medium",
|
|
3258
3455
|
children: [
|
|
3259
|
-
p ? /* @__PURE__ */ Z(
|
|
3456
|
+
p ? /* @__PURE__ */ Z(G, { className: "size-4 shrink-0 text-emerald-600" }) : /* @__PURE__ */ Z(it, { className: "size-4 shrink-0 animate-spin text-primary" }),
|
|
3260
3457
|
/* @__PURE__ */ Z("span", {
|
|
3261
3458
|
className: "min-w-0 truncate",
|
|
3262
3459
|
children: h
|
|
@@ -3274,7 +3471,7 @@ function Ea({ progress: e, designingLabel: t = "Designing your app…", extendLa
|
|
|
3274
3471
|
}) : null,
|
|
3275
3472
|
p ? null : /* @__PURE__ */ Z("span", {
|
|
3276
3473
|
className: "ml-auto shrink-0",
|
|
3277
|
-
children: /* @__PURE__ */ Z(
|
|
3474
|
+
children: /* @__PURE__ */ Z(Ma, {
|
|
3278
3475
|
active: !0,
|
|
3279
3476
|
activityKey: m,
|
|
3280
3477
|
waitingLabel: r,
|
|
@@ -3295,7 +3492,7 @@ function Ea({ progress: e, designingLabel: t = "Designing your app…", extendLa
|
|
|
3295
3492
|
className: "inline-flex animate-in fade-in items-center gap-1 rounded-md border bg-background px-1.5 py-0.5 text-[11px] text-foreground/80 duration-500",
|
|
3296
3493
|
title: e.name,
|
|
3297
3494
|
children: [
|
|
3298
|
-
/* @__PURE__ */ Z(
|
|
3495
|
+
/* @__PURE__ */ Z(gt, { className: "size-3 text-foreground/40" }),
|
|
3299
3496
|
e.label || e.name,
|
|
3300
3497
|
e.fields ? /* @__PURE__ */ Q("span", {
|
|
3301
3498
|
className: "text-foreground/40",
|
|
@@ -3311,7 +3508,7 @@ function Ea({ progress: e, designingLabel: t = "Designing your app…", extendLa
|
|
|
3311
3508
|
]
|
|
3312
3509
|
});
|
|
3313
3510
|
}
|
|
3314
|
-
function
|
|
3511
|
+
function Va({ progress: t, appSegment: n, onOpenBuiltApp: r, openBuiltAppLabel: i = "Open app", onDesignBuiltApp: a, designBuiltAppLabel: o = "Design in Studio", getArtifactAction: s, onPreviewDraftApp: c, previewDraftLabel: l = "Preview", waitingLabel: u = "Waiting for server…", stalledLabel: d = "Still working…", offlineLabel: f = "Connection lost — reconnecting…" }) {
|
|
3315
3512
|
let { phase: p, appLabel: m, items: h, done: g, total: _, seq: v } = t, y = p === "done", b = v ?? `${p}:${g}:${h.length}`, x = h.find((e) => e.type === "app"), S = _ > 0 ? Math.min(100, Math.round(g / _ * 100)) : y ? 100 : 6, C = /* @__PURE__ */ new Map();
|
|
3316
3513
|
for (let e of h) {
|
|
3317
3514
|
let t = C.get(e.type) ?? [];
|
|
@@ -3320,7 +3517,7 @@ function Da({ progress: t, appSegment: n, onOpenBuiltApp: r, openBuiltAppLabel:
|
|
|
3320
3517
|
display: e.name.replace(/_sample$/, "")
|
|
3321
3518
|
}), C.set(e.type, t);
|
|
3322
3519
|
}
|
|
3323
|
-
let w = [...
|
|
3520
|
+
let w = [...Ra.filter((e) => C.has(e)), ...[...C.keys()].filter((e) => !Ra.includes(e))];
|
|
3324
3521
|
return /* @__PURE__ */ Q("div", {
|
|
3325
3522
|
className: "rounded-lg border bg-muted/30 p-3 text-sm",
|
|
3326
3523
|
"data-testid": "build-progress",
|
|
@@ -3328,7 +3525,7 @@ function Da({ progress: t, appSegment: n, onOpenBuiltApp: r, openBuiltAppLabel:
|
|
|
3328
3525
|
/* @__PURE__ */ Q("div", {
|
|
3329
3526
|
className: "mb-2 flex items-center gap-2 font-medium",
|
|
3330
3527
|
children: [
|
|
3331
|
-
y ? /* @__PURE__ */ Z(
|
|
3528
|
+
y ? /* @__PURE__ */ Z(G, { className: "size-4 shrink-0 text-emerald-600" }) : /* @__PURE__ */ Z(it, { className: "size-4 shrink-0 animate-spin text-primary" }),
|
|
3332
3529
|
/* @__PURE__ */ Z("span", { children: y ? `Built ${m ?? "your app"}` : `Building ${m ?? "your app"}…` }),
|
|
3333
3530
|
!y && p === "data" ? /* @__PURE__ */ Z("span", {
|
|
3334
3531
|
className: "text-xs font-normal text-muted-foreground",
|
|
@@ -3336,7 +3533,7 @@ function Da({ progress: t, appSegment: n, onOpenBuiltApp: r, openBuiltAppLabel:
|
|
|
3336
3533
|
}) : null,
|
|
3337
3534
|
y ? null : /* @__PURE__ */ Z("span", {
|
|
3338
3535
|
className: "ml-auto",
|
|
3339
|
-
children: /* @__PURE__ */ Z(
|
|
3536
|
+
children: /* @__PURE__ */ Z(Ma, {
|
|
3340
3537
|
active: !0,
|
|
3341
3538
|
activityKey: b,
|
|
3342
3539
|
waitingLabel: u,
|
|
@@ -3349,7 +3546,7 @@ function Da({ progress: t, appSegment: n, onOpenBuiltApp: r, openBuiltAppLabel:
|
|
|
3349
3546
|
/* @__PURE__ */ Z("div", {
|
|
3350
3547
|
className: "mb-2 h-1.5 w-full overflow-hidden rounded-full bg-muted",
|
|
3351
3548
|
children: /* @__PURE__ */ Z("div", {
|
|
3352
|
-
className:
|
|
3549
|
+
className: W("h-full rounded-full transition-all duration-500", y ? "bg-emerald-500" : "bg-primary"),
|
|
3353
3550
|
style: { width: `${S}%` }
|
|
3354
3551
|
})
|
|
3355
3552
|
}),
|
|
@@ -3359,12 +3556,12 @@ function Da({ progress: t, appSegment: n, onOpenBuiltApp: r, openBuiltAppLabel:
|
|
|
3359
3556
|
let r = C.get(t);
|
|
3360
3557
|
return /* @__PURE__ */ Q("li", {
|
|
3361
3558
|
className: "flex items-start gap-2",
|
|
3362
|
-
children: [/* @__PURE__ */ Z(
|
|
3559
|
+
children: [/* @__PURE__ */ Z(G, { className: "mt-0.5 size-3.5 shrink-0 text-emerald-600" }), /* @__PURE__ */ Q("span", {
|
|
3363
3560
|
className: "min-w-0 text-muted-foreground",
|
|
3364
3561
|
children: [
|
|
3365
3562
|
/* @__PURE__ */ Z("span", {
|
|
3366
3563
|
className: "font-medium text-foreground",
|
|
3367
|
-
children:
|
|
3564
|
+
children: za[t] ?? t
|
|
3368
3565
|
}),
|
|
3369
3566
|
" ",
|
|
3370
3567
|
r.slice(0, 6).map((r, i) => {
|
|
@@ -3394,28 +3591,28 @@ function Da({ progress: t, appSegment: n, onOpenBuiltApp: r, openBuiltAppLabel:
|
|
|
3394
3591
|
onClick: () => a(x.name, n),
|
|
3395
3592
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90",
|
|
3396
3593
|
"data-testid": "build-progress-design-app",
|
|
3397
|
-
children: [o, /* @__PURE__ */ Z(
|
|
3594
|
+
children: [o, /* @__PURE__ */ Z(Pe, { className: "size-3.5" })]
|
|
3398
3595
|
}) : null,
|
|
3399
3596
|
r ? /* @__PURE__ */ Q("button", {
|
|
3400
3597
|
type: "button",
|
|
3401
3598
|
onClick: () => r(x.name),
|
|
3402
|
-
className:
|
|
3599
|
+
className: W("inline-flex h-7 items-center gap-1.5 rounded-md px-3 text-xs font-medium", a ? "border hover:bg-muted" : "bg-primary text-primary-foreground hover:bg-primary/90"),
|
|
3403
3600
|
"data-testid": "build-progress-open-app",
|
|
3404
|
-
children: [i, /* @__PURE__ */ Z(
|
|
3601
|
+
children: [i, /* @__PURE__ */ Z(Pe, { className: "size-3.5" })]
|
|
3405
3602
|
}) : null,
|
|
3406
3603
|
c ? /* @__PURE__ */ Q("button", {
|
|
3407
3604
|
type: "button",
|
|
3408
3605
|
onClick: () => c(x.name),
|
|
3409
3606
|
className: "inline-flex h-7 items-center gap-1.5 rounded-md border px-3 text-xs font-medium hover:bg-muted",
|
|
3410
3607
|
"data-testid": "build-progress-preview-app",
|
|
3411
|
-
children: [/* @__PURE__ */ Z(
|
|
3608
|
+
children: [/* @__PURE__ */ Z(Qe, { className: "size-3.5" }), l]
|
|
3412
3609
|
}) : null
|
|
3413
3610
|
]
|
|
3414
3611
|
}) : null
|
|
3415
3612
|
]
|
|
3416
3613
|
});
|
|
3417
3614
|
}
|
|
3418
|
-
function
|
|
3615
|
+
function Ha({ groups: e, labels: t }) {
|
|
3419
3616
|
return e.length === 0 ? null : /* @__PURE__ */ Z("div", {
|
|
3420
3617
|
className: "not-prose mb-2 border-l border-border/70 pl-3",
|
|
3421
3618
|
children: /* @__PURE__ */ Z("div", {
|
|
@@ -3425,7 +3622,7 @@ function Oa({ groups: e, labels: t }) {
|
|
|
3425
3622
|
children: [/* @__PURE__ */ Q("div", {
|
|
3426
3623
|
className: "flex min-w-0 items-center gap-2",
|
|
3427
3624
|
children: [
|
|
3428
|
-
/* @__PURE__ */ Z(
|
|
3625
|
+
/* @__PURE__ */ Z(Ua, { state: e.state }),
|
|
3429
3626
|
/* @__PURE__ */ Z("span", {
|
|
3430
3627
|
className: "truncate font-medium text-foreground",
|
|
3431
3628
|
children: e.title
|
|
@@ -3435,22 +3632,22 @@ function Oa({ groups: e, labels: t }) {
|
|
|
3435
3632
|
children: ["x", e.count]
|
|
3436
3633
|
}) : null
|
|
3437
3634
|
]
|
|
3438
|
-
}), e.state === "running" ? e.rawName === "propose_blueprint" ? /* @__PURE__ */ Z(
|
|
3635
|
+
}), e.state === "running" ? e.rawName === "propose_blueprint" ? /* @__PURE__ */ Z(Ia, {
|
|
3439
3636
|
label: t.designingPlanLabel,
|
|
3440
3637
|
hints: t.designingPlanHints,
|
|
3441
3638
|
offlineLabel: t.connectionOfflineLabel
|
|
3442
|
-
}) : /* @__PURE__ */ Z(
|
|
3443
|
-
className:
|
|
3444
|
-
children:
|
|
3639
|
+
}) : /* @__PURE__ */ Z(La, { offlineLabel: t.connectionOfflineLabel }) : /* @__PURE__ */ Z("span", {
|
|
3640
|
+
className: W("shrink-0 text-[10px] font-medium", e.state === "failed" ? "text-destructive" : e.state === "completed" ? "text-emerald-700 dark:text-emerald-400" : "text-muted-foreground"),
|
|
3641
|
+
children: Wa(e.state, t)
|
|
3445
3642
|
})]
|
|
3446
3643
|
}, e.key))
|
|
3447
3644
|
})
|
|
3448
3645
|
});
|
|
3449
3646
|
}
|
|
3450
|
-
function
|
|
3451
|
-
return e === "failed" ? /* @__PURE__ */ Z(
|
|
3647
|
+
function Ua({ state: e }) {
|
|
3648
|
+
return e === "failed" ? /* @__PURE__ */ Z(J, { className: "size-3.5 shrink-0 text-destructive" }) : e === "completed" ? /* @__PURE__ */ Z(G, { className: "size-3.5 shrink-0 text-emerald-600" }) : /* @__PURE__ */ Z(Ke, { className: "size-3.5 shrink-0 text-muted-foreground" });
|
|
3452
3649
|
}
|
|
3453
|
-
function
|
|
3650
|
+
function Wa(e, t) {
|
|
3454
3651
|
switch (e) {
|
|
3455
3652
|
case "failed": return t.toolFailed;
|
|
3456
3653
|
case "awaiting": return t.toolAwaitingApproval;
|
|
@@ -3458,8 +3655,8 @@ function Aa(e, t) {
|
|
|
3458
3655
|
case "completed": return t.toolCompleted;
|
|
3459
3656
|
}
|
|
3460
3657
|
}
|
|
3461
|
-
function
|
|
3462
|
-
let i = e.useMemo(() =>
|
|
3658
|
+
function Ga({ error: t, rateLimitedLabel: n, genericLabel: r }) {
|
|
3659
|
+
let i = e.useMemo(() => hr(t) ? n : r, [
|
|
3463
3660
|
t,
|
|
3464
3661
|
n,
|
|
3465
3662
|
r
|
|
@@ -3472,7 +3669,7 @@ function ja({ error: t, rateLimitedLabel: n, genericLabel: r }) {
|
|
|
3472
3669
|
className: "rounded-md border border-amber-300/40 bg-amber-50/60 px-3 py-2 text-foreground dark:bg-amber-950/20",
|
|
3473
3670
|
children: /* @__PURE__ */ Q("div", {
|
|
3474
3671
|
className: "flex items-start gap-2",
|
|
3475
|
-
children: [/* @__PURE__ */ Z(
|
|
3672
|
+
children: [/* @__PURE__ */ Z(_t, { className: "mt-0.5 h-4 w-4 shrink-0 text-amber-600" }), /* @__PURE__ */ Z("div", {
|
|
3476
3673
|
className: "min-w-0 flex-1 break-words leading-snug",
|
|
3477
3674
|
children: i
|
|
3478
3675
|
})]
|
|
@@ -3480,8 +3677,8 @@ function ja({ error: t, rateLimitedLabel: n, genericLabel: r }) {
|
|
|
3480
3677
|
})
|
|
3481
3678
|
});
|
|
3482
3679
|
}
|
|
3483
|
-
function
|
|
3484
|
-
let { language: i } =
|
|
3680
|
+
function Ka({ error: t, onReload: n, onUpgrade: r }) {
|
|
3681
|
+
let { language: i } = Dt(), a = Ot(), o = e.useMemo(() => fr(t), [t]), { summary: s, details: c } = e.useMemo(() => cr(t), [t]), [l, u] = e.useState(!1);
|
|
3485
3682
|
if (o) {
|
|
3486
3683
|
let e = (i.toLowerCase().startsWith("zh") ? o.message : o.messageEn ?? o.message) || a("chatbotQuota.fallbackMessage", "You have reached your AI quota."), t = o.topUp ? a("chatbotQuota.buyCredits", "Buy a credit pack") : a("chatbotQuota.upgradePlan", "Upgrade plan"), n = a("chatbotQuota.title", "Upgrade needed");
|
|
3487
3684
|
return /* @__PURE__ */ Z("div", {
|
|
@@ -3518,7 +3715,7 @@ function Ma({ error: t, onReload: n, onUpgrade: r }) {
|
|
|
3518
3715
|
children: [/* @__PURE__ */ Q("div", {
|
|
3519
3716
|
className: "flex items-start gap-2",
|
|
3520
3717
|
children: [
|
|
3521
|
-
/* @__PURE__ */ Z(
|
|
3718
|
+
/* @__PURE__ */ Z(Me, { className: "mt-0.5 h-4 w-4 shrink-0 text-destructive" }),
|
|
3522
3719
|
/* @__PURE__ */ Q("div", {
|
|
3523
3720
|
className: "min-w-0 flex-1",
|
|
3524
3721
|
children: [/* @__PURE__ */ Z("div", {
|
|
@@ -3541,7 +3738,7 @@ function Ma({ error: t, onReload: n, onUpgrade: r }) {
|
|
|
3541
3738
|
type: "button",
|
|
3542
3739
|
onClick: n,
|
|
3543
3740
|
className: "inline-flex h-7 items-center rounded-md border border-destructive/30 bg-background px-2 text-xs font-medium text-destructive hover:bg-destructive/10",
|
|
3544
|
-
children: [/* @__PURE__ */ Z(
|
|
3741
|
+
children: [/* @__PURE__ */ Z(ut, { className: "mr-1 h-3 w-3" }), a("chatbotError.retry", "Retry")]
|
|
3545
3742
|
}) : null]
|
|
3546
3743
|
})
|
|
3547
3744
|
]
|
|
@@ -3552,27 +3749,27 @@ function Ma({ error: t, onReload: n, onUpgrade: r }) {
|
|
|
3552
3749
|
})
|
|
3553
3750
|
});
|
|
3554
3751
|
}
|
|
3555
|
-
function
|
|
3556
|
-
return t ? /* @__PURE__ */ Z(
|
|
3752
|
+
function qa({ output: e, errorText: t }) {
|
|
3753
|
+
return t ? /* @__PURE__ */ Z(Ji, {
|
|
3557
3754
|
output: void 0,
|
|
3558
3755
|
errorText: t
|
|
3559
|
-
}) : e == null || e === "" ? null : typeof e == "string" && !
|
|
3756
|
+
}) : e == null || e === "" ? null : typeof e == "string" && !ua(e) ? /* @__PURE__ */ Q("div", {
|
|
3560
3757
|
className: "space-y-2 p-4",
|
|
3561
3758
|
children: [/* @__PURE__ */ Z("h4", {
|
|
3562
3759
|
className: "font-medium text-muted-foreground text-xs uppercase tracking-wide",
|
|
3563
3760
|
children: "Result"
|
|
3564
3761
|
}), /* @__PURE__ */ Z("div", {
|
|
3565
3762
|
className: "overflow-x-auto rounded-md bg-muted/40 px-3 py-2 text-sm text-foreground",
|
|
3566
|
-
children: /* @__PURE__ */ Z(
|
|
3763
|
+
children: /* @__PURE__ */ Z(Fr, { children: e })
|
|
3567
3764
|
})]
|
|
3568
|
-
}) : /* @__PURE__ */ Z(
|
|
3765
|
+
}) : /* @__PURE__ */ Z(Ji, {
|
|
3569
3766
|
output: e,
|
|
3570
3767
|
errorText: void 0
|
|
3571
3768
|
});
|
|
3572
3769
|
}
|
|
3573
3770
|
//#endregion
|
|
3574
3771
|
//#region src/FloatingChatbot.tsx
|
|
3575
|
-
function
|
|
3772
|
+
function Ja({ floatingConfig: t, headerExtra: n, headerActions: r, ...i }) {
|
|
3576
3773
|
let { position: a = "bottom-right", defaultOpen: o = !1, panelWidth: s = 400, panelHeight: c = 520, title: l = "Chat", triggerSize: u = 56 } = t ?? {}, [d, f] = e.useState(null);
|
|
3577
3774
|
e.useEffect(() => {
|
|
3578
3775
|
let e = document.getElementById("floating-chatbot-portal");
|
|
@@ -3580,19 +3777,19 @@ function Pa({ floatingConfig: t, headerExtra: n, headerActions: r, ...i }) {
|
|
|
3580
3777
|
e && e.parentNode && !e.hasChildNodes() && e.parentNode.removeChild(e);
|
|
3581
3778
|
};
|
|
3582
3779
|
}, []);
|
|
3583
|
-
let p = /* @__PURE__ */ Q(
|
|
3780
|
+
let p = /* @__PURE__ */ Q(Kn, {
|
|
3584
3781
|
defaultOpen: o,
|
|
3585
|
-
children: [/* @__PURE__ */ Z(
|
|
3782
|
+
children: [/* @__PURE__ */ Z(Qn, {
|
|
3586
3783
|
position: a,
|
|
3587
3784
|
size: u
|
|
3588
|
-
}), /* @__PURE__ */ Z(
|
|
3785
|
+
}), /* @__PURE__ */ Z(ir, {
|
|
3589
3786
|
title: l,
|
|
3590
3787
|
position: a,
|
|
3591
3788
|
width: s,
|
|
3592
3789
|
height: c,
|
|
3593
3790
|
headerExtra: n,
|
|
3594
3791
|
headerActions: r,
|
|
3595
|
-
children: /* @__PURE__ */ Z(
|
|
3792
|
+
children: /* @__PURE__ */ Z(wa, {
|
|
3596
3793
|
...i,
|
|
3597
3794
|
maxHeight: "100%",
|
|
3598
3795
|
className: "h-full border-0 rounded-none"
|
|
@@ -3601,8 +3798,8 @@ function Pa({ floatingConfig: t, headerExtra: n, headerActions: r, ...i }) {
|
|
|
3601
3798
|
});
|
|
3602
3799
|
return d ? wt.createPortal(p, d) : p;
|
|
3603
3800
|
}
|
|
3604
|
-
|
|
3605
|
-
let { messages:
|
|
3801
|
+
Rt.register("chatbot", ({ schema: e, className: t, disabled: n, ...r }) => {
|
|
3802
|
+
let { messages: i, isLoading: a, sendMessage: o } = wn({
|
|
3606
3803
|
api: e.api,
|
|
3607
3804
|
initialMessages: e.messages,
|
|
3608
3805
|
conversationId: e.conversationId,
|
|
@@ -3618,22 +3815,22 @@ Lt.register("chatbot", ({ schema: e, className: t, ...n }) => {
|
|
|
3618
3815
|
autoResponseText: e.autoResponseText,
|
|
3619
3816
|
autoResponseDelay: e.autoResponseDelay,
|
|
3620
3817
|
onSend: e.onSend
|
|
3621
|
-
})
|
|
3622
|
-
|
|
3623
|
-
|
|
3818
|
+
}), s = (e) => {
|
|
3819
|
+
o(e);
|
|
3820
|
+
}, c = l(() => hn(i), [i]);
|
|
3821
|
+
return /* @__PURE__ */ Z(go, {
|
|
3822
|
+
...zt(r),
|
|
3823
|
+
messages: c,
|
|
3624
3824
|
placeholder: e.placeholder,
|
|
3625
|
-
onSendMessage:
|
|
3626
|
-
|
|
3627
|
-
},
|
|
3628
|
-
disabled: e.disabled || i,
|
|
3825
|
+
onSendMessage: s,
|
|
3826
|
+
disabled: n || a,
|
|
3629
3827
|
showTimestamp: e.showTimestamp,
|
|
3630
3828
|
userAvatarUrl: e.userAvatarUrl,
|
|
3631
3829
|
userAvatarFallback: e.userAvatarFallback,
|
|
3632
3830
|
assistantAvatarUrl: e.assistantAvatarUrl,
|
|
3633
3831
|
assistantAvatarFallback: e.assistantAvatarFallback,
|
|
3634
3832
|
maxHeight: e.maxHeight,
|
|
3635
|
-
className: t
|
|
3636
|
-
...n
|
|
3833
|
+
className: t
|
|
3637
3834
|
});
|
|
3638
3835
|
}, {
|
|
3639
3836
|
namespace: "plugin-chatbot",
|
|
@@ -3767,8 +3964,8 @@ Lt.register("chatbot", ({ schema: e, className: t, ...n }) => {
|
|
|
3767
3964
|
autoResponseDelay: 1e3,
|
|
3768
3965
|
className: "w-full max-w-2xl"
|
|
3769
3966
|
}
|
|
3770
|
-
}),
|
|
3771
|
-
let { messages:
|
|
3967
|
+
}), Rt.register("chatbot-enhanced", ({ schema: e, className: t, disabled: n, ...r }) => {
|
|
3968
|
+
let { messages: i, isLoading: a, error: o, sendMessage: s, stop: c, reload: u, clear: d, isApiMode: f } = wn({
|
|
3772
3969
|
api: e.api,
|
|
3773
3970
|
initialMessages: e.messages,
|
|
3774
3971
|
conversationId: e.conversationId,
|
|
@@ -3784,21 +3981,22 @@ Lt.register("chatbot", ({ schema: e, className: t, ...n }) => {
|
|
|
3784
3981
|
autoResponseText: e.autoResponseText,
|
|
3785
3982
|
autoResponseDelay: e.autoResponseDelay,
|
|
3786
3983
|
onSend: e.onSend
|
|
3787
|
-
})
|
|
3788
|
-
|
|
3789
|
-
|
|
3984
|
+
}), p = (e, t) => {
|
|
3985
|
+
s(e, t);
|
|
3986
|
+
}, m = () => {
|
|
3987
|
+
d(), e.onClear?.();
|
|
3988
|
+
}, h = l(() => hn(i), [i]);
|
|
3989
|
+
return /* @__PURE__ */ Z(wa, {
|
|
3990
|
+
...zt(r),
|
|
3991
|
+
messages: h,
|
|
3790
3992
|
placeholder: e.placeholder,
|
|
3791
|
-
onSendMessage:
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
onReload: u ? c : void 0,
|
|
3799
|
-
disabled: e.disabled,
|
|
3800
|
-
isLoading: i,
|
|
3801
|
-
error: a,
|
|
3993
|
+
onSendMessage: p,
|
|
3994
|
+
onClear: m,
|
|
3995
|
+
onStop: f && a ? c : void 0,
|
|
3996
|
+
onReload: f ? u : void 0,
|
|
3997
|
+
disabled: n,
|
|
3998
|
+
isLoading: a,
|
|
3999
|
+
error: o,
|
|
3802
4000
|
showTimestamp: e.showTimestamp,
|
|
3803
4001
|
userAvatarUrl: e.userAvatarUrl,
|
|
3804
4002
|
userAvatarFallback: e.userAvatarFallback,
|
|
@@ -3808,8 +4006,7 @@ Lt.register("chatbot", ({ schema: e, className: t, ...n }) => {
|
|
|
3808
4006
|
enableMarkdown: e.enableMarkdown ?? !0,
|
|
3809
4007
|
enableFileUpload: e.enableFileUpload ?? !1,
|
|
3810
4008
|
processVisibility: e.processVisibility,
|
|
3811
|
-
className: t
|
|
3812
|
-
...n
|
|
4009
|
+
className: t
|
|
3813
4010
|
});
|
|
3814
4011
|
}, {
|
|
3815
4012
|
namespace: "plugin-chatbot",
|
|
@@ -3954,8 +4151,8 @@ Lt.register("chatbot", ({ schema: e, className: t, ...n }) => {
|
|
|
3954
4151
|
autoResponseDelay: 1e3,
|
|
3955
4152
|
className: "w-full max-w-2xl"
|
|
3956
4153
|
}
|
|
3957
|
-
}),
|
|
3958
|
-
let { messages: r, isLoading: i, error: a, sendMessage: o, stop: s, reload: c, clear:
|
|
4154
|
+
}), Rt.register("chatbot-floating", ({ schema: e, className: t, ...n }) => {
|
|
4155
|
+
let { messages: r, isLoading: i, error: a, sendMessage: o, stop: s, reload: c, clear: u, isApiMode: d } = wn({
|
|
3959
4156
|
api: e.api,
|
|
3960
4157
|
initialMessages: e.messages,
|
|
3961
4158
|
conversationId: e.conversationId,
|
|
@@ -3971,19 +4168,19 @@ Lt.register("chatbot", ({ schema: e, className: t, ...n }) => {
|
|
|
3971
4168
|
autoResponseText: e.autoResponseText,
|
|
3972
4169
|
autoResponseDelay: e.autoResponseDelay,
|
|
3973
4170
|
onSend: e.onSend
|
|
3974
|
-
})
|
|
3975
|
-
|
|
4171
|
+
}), f = (e, t) => {
|
|
4172
|
+
o(e, t);
|
|
4173
|
+
}, p = () => {
|
|
4174
|
+
u(), e.onClear?.();
|
|
4175
|
+
}, m = l(() => hn(r), [r]);
|
|
4176
|
+
return /* @__PURE__ */ Z(Ja, {
|
|
3976
4177
|
floatingConfig: e.floatingConfig,
|
|
3977
|
-
messages:
|
|
4178
|
+
messages: m,
|
|
3978
4179
|
placeholder: e.placeholder,
|
|
3979
|
-
onSendMessage:
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
l(), e.onClear?.();
|
|
3984
|
-
},
|
|
3985
|
-
onStop: u && i ? s : void 0,
|
|
3986
|
-
onReload: u ? c : void 0,
|
|
4180
|
+
onSendMessage: f,
|
|
4181
|
+
onClear: p,
|
|
4182
|
+
onStop: d && i ? s : void 0,
|
|
4183
|
+
onReload: d ? c : void 0,
|
|
3987
4184
|
disabled: e.disabled,
|
|
3988
4185
|
isLoading: i,
|
|
3989
4186
|
error: a,
|
|
@@ -4144,7 +4341,7 @@ Lt.register("chatbot", ({ schema: e, className: t, ...n }) => {
|
|
|
4144
4341
|
});
|
|
4145
4342
|
//#endregion
|
|
4146
4343
|
//#region src/elements/loader.tsx
|
|
4147
|
-
var
|
|
4344
|
+
var Ya = ({ size: e = 16 }) => /* @__PURE__ */ Q("svg", {
|
|
4148
4345
|
height: e,
|
|
4149
4346
|
strokeLinejoin: "round",
|
|
4150
4347
|
style: { color: "currentcolor" },
|
|
@@ -4225,97 +4422,97 @@ var Fa = ({ size: e = 16 }) => /* @__PURE__ */ Q("svg", {
|
|
|
4225
4422
|
})
|
|
4226
4423
|
}) })
|
|
4227
4424
|
]
|
|
4228
|
-
}),
|
|
4229
|
-
className:
|
|
4425
|
+
}), Xa = ({ className: e, size: t = 16, ...n }) => /* @__PURE__ */ Z("div", {
|
|
4426
|
+
className: W("inline-flex animate-spin items-center justify-center", e),
|
|
4230
4427
|
...n,
|
|
4231
|
-
children: /* @__PURE__ */ Z(
|
|
4232
|
-
}),
|
|
4233
|
-
CodeBlock: () =>
|
|
4234
|
-
CodeBlockCopyButton: () =>
|
|
4235
|
-
Conversation: () =>
|
|
4236
|
-
ConversationContent: () =>
|
|
4237
|
-
ConversationEmptyState: () =>
|
|
4238
|
-
ConversationScrollButton: () =>
|
|
4239
|
-
Loader: () =>
|
|
4240
|
-
Message: () =>
|
|
4241
|
-
MessageAction: () =>
|
|
4242
|
-
MessageActions: () =>
|
|
4243
|
-
MessageAttachment: () =>
|
|
4244
|
-
MessageAttachments: () =>
|
|
4245
|
-
MessageBranch: () =>
|
|
4246
|
-
MessageBranchContent: () =>
|
|
4247
|
-
MessageBranchNext: () =>
|
|
4248
|
-
MessageBranchPage: () =>
|
|
4249
|
-
MessageBranchPrevious: () =>
|
|
4250
|
-
MessageBranchSelector: () =>
|
|
4251
|
-
MessageContent: () =>
|
|
4252
|
-
MessageResponse: () =>
|
|
4253
|
-
MessageToolbar: () =>
|
|
4254
|
-
PromptInput: () =>
|
|
4255
|
-
PromptInputActionAddAttachments: () =>
|
|
4256
|
-
PromptInputActionMenu: () =>
|
|
4257
|
-
PromptInputActionMenuContent: () =>
|
|
4258
|
-
PromptInputActionMenuItem: () =>
|
|
4259
|
-
PromptInputActionMenuTrigger: () =>
|
|
4260
|
-
PromptInputAttachment: () =>
|
|
4261
|
-
PromptInputAttachments: () =>
|
|
4262
|
-
PromptInputBody: () =>
|
|
4263
|
-
PromptInputButton: () =>
|
|
4264
|
-
PromptInputCommand: () =>
|
|
4265
|
-
PromptInputCommandEmpty: () =>
|
|
4266
|
-
PromptInputCommandGroup: () =>
|
|
4267
|
-
PromptInputCommandInput: () =>
|
|
4268
|
-
PromptInputCommandItem: () =>
|
|
4269
|
-
PromptInputCommandList: () =>
|
|
4270
|
-
PromptInputCommandSeparator: () =>
|
|
4271
|
-
PromptInputFooter: () =>
|
|
4272
|
-
PromptInputHeader: () =>
|
|
4273
|
-
PromptInputHoverCard: () =>
|
|
4274
|
-
PromptInputHoverCardContent: () =>
|
|
4275
|
-
PromptInputHoverCardTrigger: () =>
|
|
4276
|
-
PromptInputProvider: () =>
|
|
4277
|
-
PromptInputSelect: () =>
|
|
4278
|
-
PromptInputSelectContent: () =>
|
|
4279
|
-
PromptInputSelectItem: () =>
|
|
4280
|
-
PromptInputSelectTrigger: () =>
|
|
4281
|
-
PromptInputSelectValue: () =>
|
|
4282
|
-
PromptInputSpeechButton: () =>
|
|
4283
|
-
PromptInputSubmit: () =>
|
|
4284
|
-
PromptInputTab: () =>
|
|
4285
|
-
PromptInputTabBody: () =>
|
|
4286
|
-
PromptInputTabItem: () =>
|
|
4287
|
-
PromptInputTabLabel: () =>
|
|
4288
|
-
PromptInputTabsList: () =>
|
|
4289
|
-
PromptInputTextarea: () =>
|
|
4290
|
-
PromptInputTools: () =>
|
|
4291
|
-
Reasoning: () =>
|
|
4292
|
-
ReasoningContent: () =>
|
|
4293
|
-
ReasoningTrigger: () =>
|
|
4294
|
-
Shimmer: () =>
|
|
4295
|
-
Source: () =>
|
|
4296
|
-
Sources: () =>
|
|
4297
|
-
SourcesContent: () =>
|
|
4298
|
-
SourcesTrigger: () =>
|
|
4299
|
-
Suggestion: () =>
|
|
4300
|
-
Suggestions: () =>
|
|
4301
|
-
Tool: () =>
|
|
4302
|
-
ToolContent: () =>
|
|
4303
|
-
ToolHeader: () =>
|
|
4304
|
-
ToolInput: () =>
|
|
4305
|
-
ToolOutput: () =>
|
|
4306
|
-
highlightCode: () =>
|
|
4307
|
-
usePromptInputAttachments: () =>
|
|
4308
|
-
usePromptInputController: () =>
|
|
4309
|
-
useProviderAttachments: () =>
|
|
4310
|
-
useReasoning: () =>
|
|
4311
|
-
}),
|
|
4312
|
-
function
|
|
4428
|
+
children: /* @__PURE__ */ Z(Ya, { size: t })
|
|
4429
|
+
}), Za = /* @__PURE__ */ Vt({
|
|
4430
|
+
CodeBlock: () => Vi,
|
|
4431
|
+
CodeBlockCopyButton: () => Hi,
|
|
4432
|
+
Conversation: () => gr,
|
|
4433
|
+
ConversationContent: () => _r,
|
|
4434
|
+
ConversationEmptyState: () => vr,
|
|
4435
|
+
ConversationScrollButton: () => yr,
|
|
4436
|
+
Loader: () => Xa,
|
|
4437
|
+
Message: () => Cr,
|
|
4438
|
+
MessageAction: () => Er,
|
|
4439
|
+
MessageActions: () => Tr,
|
|
4440
|
+
MessageAttachment: () => Ir,
|
|
4441
|
+
MessageAttachments: () => Lr,
|
|
4442
|
+
MessageBranch: () => kr,
|
|
4443
|
+
MessageBranchContent: () => Ar,
|
|
4444
|
+
MessageBranchNext: () => Nr,
|
|
4445
|
+
MessageBranchPage: () => Pr,
|
|
4446
|
+
MessageBranchPrevious: () => Mr,
|
|
4447
|
+
MessageBranchSelector: () => jr,
|
|
4448
|
+
MessageContent: () => wr,
|
|
4449
|
+
MessageResponse: () => Fr,
|
|
4450
|
+
MessageToolbar: () => Rr,
|
|
4451
|
+
PromptInput: () => ri,
|
|
4452
|
+
PromptInputActionAddAttachments: () => ni,
|
|
4453
|
+
PromptInputActionMenu: () => ui,
|
|
4454
|
+
PromptInputActionMenuContent: () => fi,
|
|
4455
|
+
PromptInputActionMenuItem: () => pi,
|
|
4456
|
+
PromptInputActionMenuTrigger: () => di,
|
|
4457
|
+
PromptInputAttachment: () => ei,
|
|
4458
|
+
PromptInputAttachments: () => ti,
|
|
4459
|
+
PromptInputBody: () => ii,
|
|
4460
|
+
PromptInputButton: () => li,
|
|
4461
|
+
PromptInputCommand: () => ki,
|
|
4462
|
+
PromptInputCommandEmpty: () => Mi,
|
|
4463
|
+
PromptInputCommandGroup: () => Ni,
|
|
4464
|
+
PromptInputCommandInput: () => Ai,
|
|
4465
|
+
PromptInputCommandItem: () => Pi,
|
|
4466
|
+
PromptInputCommandList: () => ji,
|
|
4467
|
+
PromptInputCommandSeparator: () => Fi,
|
|
4468
|
+
PromptInputFooter: () => si,
|
|
4469
|
+
PromptInputHeader: () => oi,
|
|
4470
|
+
PromptInputHoverCard: () => xi,
|
|
4471
|
+
PromptInputHoverCardContent: () => Ci,
|
|
4472
|
+
PromptInputHoverCardTrigger: () => Si,
|
|
4473
|
+
PromptInputProvider: () => Zr,
|
|
4474
|
+
PromptInputSelect: () => gi,
|
|
4475
|
+
PromptInputSelectContent: () => vi,
|
|
4476
|
+
PromptInputSelectItem: () => yi,
|
|
4477
|
+
PromptInputSelectTrigger: () => _i,
|
|
4478
|
+
PromptInputSelectValue: () => bi,
|
|
4479
|
+
PromptInputSpeechButton: () => hi,
|
|
4480
|
+
PromptInputSubmit: () => mi,
|
|
4481
|
+
PromptInputTab: () => Ti,
|
|
4482
|
+
PromptInputTabBody: () => Di,
|
|
4483
|
+
PromptInputTabItem: () => Oi,
|
|
4484
|
+
PromptInputTabLabel: () => Ei,
|
|
4485
|
+
PromptInputTabsList: () => wi,
|
|
4486
|
+
PromptInputTextarea: () => ai,
|
|
4487
|
+
PromptInputTools: () => ci,
|
|
4488
|
+
Reasoning: () => ea,
|
|
4489
|
+
ReasoningContent: () => ra,
|
|
4490
|
+
ReasoningTrigger: () => na,
|
|
4491
|
+
Shimmer: () => Yi,
|
|
4492
|
+
Source: () => sa,
|
|
4493
|
+
Sources: () => ia,
|
|
4494
|
+
SourcesContent: () => oa,
|
|
4495
|
+
SourcesTrigger: () => aa,
|
|
4496
|
+
Suggestion: () => Li,
|
|
4497
|
+
Suggestions: () => Ii,
|
|
4498
|
+
Tool: () => Ui,
|
|
4499
|
+
ToolContent: () => Ki,
|
|
4500
|
+
ToolHeader: () => Gi,
|
|
4501
|
+
ToolInput: () => qi,
|
|
4502
|
+
ToolOutput: () => Ji,
|
|
4503
|
+
highlightCode: () => Bi,
|
|
4504
|
+
usePromptInputAttachments: () => $r,
|
|
4505
|
+
usePromptInputController: () => qr,
|
|
4506
|
+
useProviderAttachments: () => Yr,
|
|
4507
|
+
useReasoning: () => Zi
|
|
4508
|
+
}), Qa = "/api/v1/ai";
|
|
4509
|
+
function $a(e, t, n) {
|
|
4313
4510
|
let r = e.replace(/\/$/, ""), i = new URLSearchParams();
|
|
4314
4511
|
if (n) for (let [e, t] of Object.entries(n)) t != null && t !== "" && i.set(e, String(t));
|
|
4315
4512
|
let a = i.toString();
|
|
4316
4513
|
return `${r}${t}${a ? `?${a}` : ""}`;
|
|
4317
4514
|
}
|
|
4318
|
-
async function
|
|
4515
|
+
async function eo(e, t, n) {
|
|
4319
4516
|
let r = await fetch(e, {
|
|
4320
4517
|
credentials: "include",
|
|
4321
4518
|
...t,
|
|
@@ -4335,8 +4532,8 @@ async function Ba(e, t, n) {
|
|
|
4335
4532
|
}
|
|
4336
4533
|
return i;
|
|
4337
4534
|
}
|
|
4338
|
-
function
|
|
4339
|
-
let { apiBase: n =
|
|
4535
|
+
function to(t = {}) {
|
|
4536
|
+
let { apiBase: n = Qa, status: r = "pending", conversationId: i, limit: a, headers: o, pollInterval: s = 5e3, enabled: c = !0 } = t, [l, u] = e.useState([]), [d, f] = e.useState(0), [p, m] = e.useState(!1), [h, g] = e.useState(void 0), _ = e.useRef({
|
|
4340
4537
|
apiBase: n,
|
|
4341
4538
|
status: r,
|
|
4342
4539
|
conversationId: i,
|
|
@@ -4354,7 +4551,7 @@ function Va(t = {}) {
|
|
|
4354
4551
|
let { apiBase: e, status: t, conversationId: n, limit: r, headers: i } = _.current;
|
|
4355
4552
|
m(!0), g(void 0);
|
|
4356
4553
|
try {
|
|
4357
|
-
let a = await
|
|
4554
|
+
let a = await eo($a(e, "/pending-actions", {
|
|
4358
4555
|
status: t && t !== "all" ? t : void 0,
|
|
4359
4556
|
conversationId: n,
|
|
4360
4557
|
limit: r
|
|
@@ -4366,9 +4563,9 @@ function Va(t = {}) {
|
|
|
4366
4563
|
m(!1);
|
|
4367
4564
|
}
|
|
4368
4565
|
}, []), y = e.useCallback(async (e) => {
|
|
4369
|
-
let { apiBase: t, headers: n } = _.current, r =
|
|
4566
|
+
let { apiBase: t, headers: n } = _.current, r = $a(t, `/pending-actions/${encodeURIComponent(e)}/approve`);
|
|
4370
4567
|
try {
|
|
4371
|
-
return await
|
|
4568
|
+
return await eo(r, {
|
|
4372
4569
|
method: "POST",
|
|
4373
4570
|
body: "{}"
|
|
4374
4571
|
}, n);
|
|
@@ -4376,9 +4573,9 @@ function Va(t = {}) {
|
|
|
4376
4573
|
v();
|
|
4377
4574
|
}
|
|
4378
4575
|
}, [v]), b = e.useCallback(async (e, t) => {
|
|
4379
|
-
let { apiBase: n, headers: r } = _.current, i =
|
|
4576
|
+
let { apiBase: n, headers: r } = _.current, i = $a(n, `/pending-actions/${encodeURIComponent(e)}/reject`);
|
|
4380
4577
|
try {
|
|
4381
|
-
return await
|
|
4578
|
+
return await eo(i, {
|
|
4382
4579
|
method: "POST",
|
|
4383
4580
|
body: JSON.stringify(t ? { reason: t } : {})
|
|
4384
4581
|
}, r);
|
|
@@ -4412,7 +4609,7 @@ function Va(t = {}) {
|
|
|
4412
4609
|
}
|
|
4413
4610
|
//#endregion
|
|
4414
4611
|
//#region src/AiPendingActionsInbox.tsx
|
|
4415
|
-
var
|
|
4612
|
+
var no = {
|
|
4416
4613
|
pending: {
|
|
4417
4614
|
variant: "secondary",
|
|
4418
4615
|
label: "Pending"
|
|
@@ -4434,8 +4631,8 @@ var Ha = {
|
|
|
4434
4631
|
label: "Rejected"
|
|
4435
4632
|
}
|
|
4436
4633
|
};
|
|
4437
|
-
function
|
|
4438
|
-
let t =
|
|
4634
|
+
function ro({ status: e }) {
|
|
4635
|
+
let t = no[e] ?? {
|
|
4439
4636
|
variant: "outline",
|
|
4440
4637
|
label: e
|
|
4441
4638
|
};
|
|
@@ -4444,7 +4641,7 @@ function Ua({ status: e }) {
|
|
|
4444
4641
|
children: t.label
|
|
4445
4642
|
});
|
|
4446
4643
|
}
|
|
4447
|
-
function
|
|
4644
|
+
function io(e) {
|
|
4448
4645
|
if (!e) return "—";
|
|
4449
4646
|
let t = Date.parse(e);
|
|
4450
4647
|
if (Number.isNaN(t)) return e;
|
|
@@ -4462,7 +4659,7 @@ function Wa(e) {
|
|
|
4462
4659
|
return e;
|
|
4463
4660
|
}
|
|
4464
4661
|
}
|
|
4465
|
-
function
|
|
4662
|
+
function ao(e) {
|
|
4466
4663
|
if (!e) return null;
|
|
4467
4664
|
try {
|
|
4468
4665
|
return JSON.parse(e);
|
|
@@ -4470,7 +4667,7 @@ function Ga(e) {
|
|
|
4470
4667
|
return e;
|
|
4471
4668
|
}
|
|
4472
4669
|
}
|
|
4473
|
-
function
|
|
4670
|
+
function oo({ value: e, max: t = 320 }) {
|
|
4474
4671
|
let n = typeof e == "string" ? e : JSON.stringify(e, null, 2);
|
|
4475
4672
|
return n == null || n === "" ? /* @__PURE__ */ Z("span", {
|
|
4476
4673
|
className: "text-muted-foreground text-xs",
|
|
@@ -4481,20 +4678,20 @@ function Ka({ value: e, max: t = 320 }) {
|
|
|
4481
4678
|
children: n
|
|
4482
4679
|
});
|
|
4483
4680
|
}
|
|
4484
|
-
function
|
|
4681
|
+
function so(e) {
|
|
4485
4682
|
switch (e) {
|
|
4486
4683
|
case "pending": return "pending";
|
|
4487
4684
|
case "all": return "all";
|
|
4488
4685
|
case "decided": return "all";
|
|
4489
4686
|
}
|
|
4490
4687
|
}
|
|
4491
|
-
function
|
|
4492
|
-
let [l, u] = e.useState("pending"), [d, m] = e.useState(null), [h, g] = e.useState(null), [_, w] = e.useState(""), [T, E] = e.useState(null), [D, O] = e.useState(null), [k, A] = e.useState(null), { items: j, isLoading: M, error: N, refresh: ee, approve: P, reject: F } =
|
|
4688
|
+
function co({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i, variant: a = "card", title: o = "AI Approvals", description: s = "Actions an AI agent proposed that need a human review before execution.", className: c }) {
|
|
4689
|
+
let [l, u] = e.useState("pending"), [d, m] = e.useState(null), [h, g] = e.useState(null), [_, w] = e.useState(""), [T, E] = e.useState(null), [D, O] = e.useState(null), [k, A] = e.useState(null), { items: j, isLoading: M, error: N, refresh: ee, approve: P, reject: F } = to({
|
|
4493
4690
|
apiBase: t,
|
|
4494
4691
|
headers: n,
|
|
4495
4692
|
pollInterval: r,
|
|
4496
4693
|
conversationId: i,
|
|
4497
|
-
status:
|
|
4694
|
+
status: so(l)
|
|
4498
4695
|
}), I = e.useMemo(() => l === "decided" ? j.filter((e) => e.status !== "pending") : j, [j, l]), R = e.useMemo(() => d ? j.find((e) => e.id === d) ?? null : null, [d, j]), ae = e.useCallback(async (e) => {
|
|
4499
4696
|
E(e), O(null);
|
|
4500
4697
|
try {
|
|
@@ -4541,19 +4738,19 @@ function Ja({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4541
4738
|
children: [
|
|
4542
4739
|
/* @__PURE__ */ Q("div", {
|
|
4543
4740
|
className: "flex items-center justify-between gap-2",
|
|
4544
|
-
children: [/* @__PURE__ */ Z(
|
|
4741
|
+
children: [/* @__PURE__ */ Z(we, {
|
|
4545
4742
|
value: l,
|
|
4546
4743
|
onValueChange: (e) => u(e),
|
|
4547
|
-
children: /* @__PURE__ */ Q(
|
|
4548
|
-
/* @__PURE__ */ Z(
|
|
4744
|
+
children: /* @__PURE__ */ Q(Te, { children: [
|
|
4745
|
+
/* @__PURE__ */ Z(Ee, {
|
|
4549
4746
|
value: "pending",
|
|
4550
4747
|
children: "Pending"
|
|
4551
4748
|
}),
|
|
4552
|
-
/* @__PURE__ */ Z(
|
|
4749
|
+
/* @__PURE__ */ Z(Ee, {
|
|
4553
4750
|
value: "decided",
|
|
4554
4751
|
children: "Decided"
|
|
4555
4752
|
}),
|
|
4556
|
-
/* @__PURE__ */ Z(
|
|
4753
|
+
/* @__PURE__ */ Z(Ee, {
|
|
4557
4754
|
value: "all",
|
|
4558
4755
|
children: "All"
|
|
4559
4756
|
})
|
|
@@ -4564,20 +4761,20 @@ function Ja({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4564
4761
|
onClick: () => void ee(),
|
|
4565
4762
|
disabled: M,
|
|
4566
4763
|
"data-testid": "ai-inbox-refresh",
|
|
4567
|
-
children: [/* @__PURE__ */ Z(
|
|
4764
|
+
children: [/* @__PURE__ */ Z(ut, { className: `h-3.5 w-3.5 mr-1.5 ${M ? "animate-spin" : ""}` }), "Refresh"]
|
|
4568
4765
|
})]
|
|
4569
4766
|
}),
|
|
4570
4767
|
N ? /* @__PURE__ */ Q(f, {
|
|
4571
4768
|
variant: "destructive",
|
|
4572
|
-
children: [/* @__PURE__ */ Z(
|
|
4769
|
+
children: [/* @__PURE__ */ Z(Me, { className: "h-4 w-4" }), /* @__PURE__ */ Z(p, { children: N.message })]
|
|
4573
4770
|
}) : null,
|
|
4574
4771
|
D ? /* @__PURE__ */ Q(f, {
|
|
4575
4772
|
variant: "destructive",
|
|
4576
|
-
children: [/* @__PURE__ */ Z(
|
|
4773
|
+
children: [/* @__PURE__ */ Z(Me, { className: "h-4 w-4" }), /* @__PURE__ */ Z(p, { children: D })]
|
|
4577
4774
|
}) : null,
|
|
4578
4775
|
k && !D ? /* @__PURE__ */ Q(f, {
|
|
4579
4776
|
variant: k.ok ? "default" : "destructive",
|
|
4580
|
-
children: [k.ok ? /* @__PURE__ */ Z(
|
|
4777
|
+
children: [k.ok ? /* @__PURE__ */ Z(G, { className: "h-4 w-4" }) : /* @__PURE__ */ Z(J, { className: "h-4 w-4" }), /* @__PURE__ */ Q(p, { children: [
|
|
4581
4778
|
k.kind === "approve" ? "Approve" : "Reject",
|
|
4582
4779
|
" for",
|
|
4583
4780
|
" ",
|
|
@@ -4593,69 +4790,69 @@ function Ja({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4593
4790
|
M && I.length === 0 ? /* @__PURE__ */ Q("div", {
|
|
4594
4791
|
className: "space-y-2",
|
|
4595
4792
|
children: [
|
|
4596
|
-
/* @__PURE__ */ Z(
|
|
4597
|
-
/* @__PURE__ */ Z(
|
|
4598
|
-
/* @__PURE__ */ Z(
|
|
4793
|
+
/* @__PURE__ */ Z(ye, { className: "h-10 w-full" }),
|
|
4794
|
+
/* @__PURE__ */ Z(ye, { className: "h-10 w-full" }),
|
|
4795
|
+
/* @__PURE__ */ Z(ye, { className: "h-10 w-full" })
|
|
4599
4796
|
]
|
|
4600
4797
|
}) : I.length === 0 ? /* @__PURE__ */ Z(te, { children: /* @__PURE__ */ Q(L, { children: [
|
|
4601
|
-
/* @__PURE__ */ Z(re, { children: /* @__PURE__ */ Z(
|
|
4798
|
+
/* @__PURE__ */ Z(re, { children: /* @__PURE__ */ Z(rt, { className: "h-8 w-8 text-muted-foreground" }) }),
|
|
4602
4799
|
/* @__PURE__ */ Z(ie, { children: "No actions waiting" }),
|
|
4603
4800
|
/* @__PURE__ */ Z(ne, { children: "When the AI proposes a sensitive action it will appear here for review." })
|
|
4604
4801
|
] }) }) : /* @__PURE__ */ Z("div", {
|
|
4605
4802
|
className: "rounded-md border",
|
|
4606
|
-
children: /* @__PURE__ */ Q(
|
|
4607
|
-
/* @__PURE__ */ Z(
|
|
4803
|
+
children: /* @__PURE__ */ Q(be, { children: [/* @__PURE__ */ Z(Se, { children: /* @__PURE__ */ Q(Ce, { children: [
|
|
4804
|
+
/* @__PURE__ */ Z(U, {
|
|
4608
4805
|
className: "w-[140px]",
|
|
4609
4806
|
children: "Tool"
|
|
4610
4807
|
}),
|
|
4611
|
-
/* @__PURE__ */ Z(
|
|
4808
|
+
/* @__PURE__ */ Z(U, {
|
|
4612
4809
|
className: "w-[140px]",
|
|
4613
4810
|
children: "Action"
|
|
4614
4811
|
}),
|
|
4615
|
-
/* @__PURE__ */ Z(
|
|
4812
|
+
/* @__PURE__ */ Z(U, {
|
|
4616
4813
|
className: "w-[120px]",
|
|
4617
4814
|
children: "Object"
|
|
4618
4815
|
}),
|
|
4619
|
-
/* @__PURE__ */ Z(
|
|
4816
|
+
/* @__PURE__ */ Z(U, {
|
|
4620
4817
|
className: "w-[110px]",
|
|
4621
4818
|
children: "Status"
|
|
4622
4819
|
}),
|
|
4623
|
-
/* @__PURE__ */ Z(
|
|
4820
|
+
/* @__PURE__ */ Z(U, {
|
|
4624
4821
|
className: "w-[110px]",
|
|
4625
4822
|
children: "Proposed"
|
|
4626
4823
|
}),
|
|
4627
|
-
/* @__PURE__ */ Z(
|
|
4824
|
+
/* @__PURE__ */ Z(U, {
|
|
4628
4825
|
className: "w-[260px] text-right",
|
|
4629
4826
|
children: "Decision"
|
|
4630
4827
|
})
|
|
4631
|
-
] }) }), /* @__PURE__ */ Z(
|
|
4828
|
+
] }) }), /* @__PURE__ */ Z(xe, { children: I.map((e) => {
|
|
4632
4829
|
let t = e.status === "pending", n = T === e.id;
|
|
4633
|
-
return /* @__PURE__ */ Q(
|
|
4634
|
-
/* @__PURE__ */ Z(
|
|
4830
|
+
return /* @__PURE__ */ Q(Ce, { children: [
|
|
4831
|
+
/* @__PURE__ */ Z(H, {
|
|
4635
4832
|
className: "font-mono text-xs",
|
|
4636
4833
|
children: e.tool_name
|
|
4637
4834
|
}),
|
|
4638
|
-
/* @__PURE__ */ Z(
|
|
4835
|
+
/* @__PURE__ */ Z(H, {
|
|
4639
4836
|
className: "text-sm",
|
|
4640
4837
|
children: e.action_name
|
|
4641
4838
|
}),
|
|
4642
|
-
/* @__PURE__ */ Z(
|
|
4839
|
+
/* @__PURE__ */ Z(H, {
|
|
4643
4840
|
className: "text-sm",
|
|
4644
4841
|
children: e.object_name
|
|
4645
4842
|
}),
|
|
4646
|
-
/* @__PURE__ */ Z(
|
|
4647
|
-
/* @__PURE__ */ Z(
|
|
4843
|
+
/* @__PURE__ */ Z(H, { children: /* @__PURE__ */ Z(ro, { status: e.status }) }),
|
|
4844
|
+
/* @__PURE__ */ Z(H, {
|
|
4648
4845
|
className: "text-xs text-muted-foreground",
|
|
4649
4846
|
children: /* @__PURE__ */ Q("span", {
|
|
4650
4847
|
className: "inline-flex items-center gap-1",
|
|
4651
4848
|
children: [
|
|
4652
|
-
/* @__PURE__ */ Z(
|
|
4849
|
+
/* @__PURE__ */ Z(Ge, { className: "h-3 w-3" }),
|
|
4653
4850
|
" ",
|
|
4654
|
-
|
|
4851
|
+
io(e.proposed_at)
|
|
4655
4852
|
]
|
|
4656
4853
|
})
|
|
4657
4854
|
}),
|
|
4658
|
-
/* @__PURE__ */ Z(
|
|
4855
|
+
/* @__PURE__ */ Z(H, {
|
|
4659
4856
|
className: "text-right",
|
|
4660
4857
|
children: /* @__PURE__ */ Q("div", {
|
|
4661
4858
|
className: "inline-flex gap-1.5",
|
|
@@ -4664,14 +4861,14 @@ function Ja({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4664
4861
|
variant: "ghost",
|
|
4665
4862
|
onClick: () => m(e.id),
|
|
4666
4863
|
"data-testid": `ai-inbox-view-${e.id}`,
|
|
4667
|
-
children: [/* @__PURE__ */ Z(
|
|
4864
|
+
children: [/* @__PURE__ */ Z(Qe, { className: "h-3.5 w-3.5 mr-1" }), " View"]
|
|
4668
4865
|
}), t ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Q(v, {
|
|
4669
4866
|
size: "sm",
|
|
4670
4867
|
variant: "default",
|
|
4671
4868
|
disabled: n,
|
|
4672
4869
|
onClick: () => void ae(e.id),
|
|
4673
4870
|
"data-testid": `ai-inbox-approve-${e.id}`,
|
|
4674
|
-
children: [/* @__PURE__ */ Z(
|
|
4871
|
+
children: [/* @__PURE__ */ Z(G, { className: "h-3.5 w-3.5 mr-1" }), n ? "Working…" : "Approve"]
|
|
4675
4872
|
}), /* @__PURE__ */ Q(v, {
|
|
4676
4873
|
size: "sm",
|
|
4677
4874
|
variant: "destructive",
|
|
@@ -4680,7 +4877,7 @@ function Ja({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4680
4877
|
g(e.id), w("");
|
|
4681
4878
|
},
|
|
4682
4879
|
"data-testid": `ai-inbox-reject-${e.id}`,
|
|
4683
|
-
children: [/* @__PURE__ */ Z(
|
|
4880
|
+
children: [/* @__PURE__ */ Z(J, { className: "h-3.5 w-3.5 mr-1" }), "Reject"]
|
|
4684
4881
|
})] }) : null]
|
|
4685
4882
|
})
|
|
4686
4883
|
})
|
|
@@ -4697,7 +4894,7 @@ function Ja({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4697
4894
|
children: [/* @__PURE__ */ Q(C, {
|
|
4698
4895
|
className: "flex items-center gap-2",
|
|
4699
4896
|
children: [
|
|
4700
|
-
/* @__PURE__ */ Z(
|
|
4897
|
+
/* @__PURE__ */ Z(Ie, { className: "h-4 w-4" }),
|
|
4701
4898
|
" ",
|
|
4702
4899
|
o
|
|
4703
4900
|
]
|
|
@@ -4707,17 +4904,17 @@ function Ja({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4707
4904
|
className: c,
|
|
4708
4905
|
children: z
|
|
4709
4906
|
}),
|
|
4710
|
-
/* @__PURE__ */ Z(
|
|
4907
|
+
/* @__PURE__ */ Z(me, {
|
|
4711
4908
|
open: !!d,
|
|
4712
4909
|
onOpenChange: (e) => {
|
|
4713
4910
|
e || m(null);
|
|
4714
4911
|
},
|
|
4715
|
-
children: /* @__PURE__ */ Q(
|
|
4912
|
+
children: /* @__PURE__ */ Q(he, {
|
|
4716
4913
|
className: "sm:max-w-[560px] overflow-y-auto",
|
|
4717
|
-
children: [/* @__PURE__ */ Q(
|
|
4914
|
+
children: [/* @__PURE__ */ Q(_e, { children: [/* @__PURE__ */ Q(ve, {
|
|
4718
4915
|
className: "flex items-center gap-2",
|
|
4719
|
-
children: [/* @__PURE__ */ Z(
|
|
4720
|
-
}), /* @__PURE__ */ Z(
|
|
4916
|
+
children: [/* @__PURE__ */ Z(Ie, { className: "h-4 w-4" }), R ? R.action_name : "Pending action"]
|
|
4917
|
+
}), /* @__PURE__ */ Z(ge, { children: R ? /* @__PURE__ */ Q(X, { children: [
|
|
4721
4918
|
"Tool ",
|
|
4722
4919
|
/* @__PURE__ */ Z("code", {
|
|
4723
4920
|
className: "text-xs",
|
|
@@ -4740,14 +4937,14 @@ function Ja({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4740
4937
|
children: "Status"
|
|
4741
4938
|
}), /* @__PURE__ */ Z("div", {
|
|
4742
4939
|
className: "mt-1",
|
|
4743
|
-
children: /* @__PURE__ */ Z(
|
|
4940
|
+
children: /* @__PURE__ */ Z(ro, { status: R.status })
|
|
4744
4941
|
})] }),
|
|
4745
4942
|
/* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z(B, {
|
|
4746
4943
|
className: "text-xs text-muted-foreground",
|
|
4747
4944
|
children: "Proposed"
|
|
4748
4945
|
}), /* @__PURE__ */ Z("div", {
|
|
4749
4946
|
className: "mt-1 text-xs",
|
|
4750
|
-
children:
|
|
4947
|
+
children: io(R.proposed_at)
|
|
4751
4948
|
})] }),
|
|
4752
4949
|
/* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z(B, {
|
|
4753
4950
|
className: "text-xs text-muted-foreground",
|
|
@@ -4775,27 +4972,27 @@ function Ja({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4775
4972
|
}) : null
|
|
4776
4973
|
]
|
|
4777
4974
|
}),
|
|
4778
|
-
/* @__PURE__ */ Z(
|
|
4975
|
+
/* @__PURE__ */ Z(pe, {}),
|
|
4779
4976
|
/* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z(B, {
|
|
4780
4977
|
className: "text-xs",
|
|
4781
4978
|
children: "Tool input"
|
|
4782
4979
|
}), /* @__PURE__ */ Z("div", {
|
|
4783
4980
|
className: "mt-1.5",
|
|
4784
|
-
children: /* @__PURE__ */ Z(
|
|
4981
|
+
children: /* @__PURE__ */ Z(oo, { value: ao(R.tool_input) })
|
|
4785
4982
|
})] }),
|
|
4786
4983
|
R.result ? /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z(B, {
|
|
4787
4984
|
className: "text-xs",
|
|
4788
4985
|
children: "Result"
|
|
4789
4986
|
}), /* @__PURE__ */ Z("div", {
|
|
4790
4987
|
className: "mt-1.5",
|
|
4791
|
-
children: /* @__PURE__ */ Z(
|
|
4988
|
+
children: /* @__PURE__ */ Z(oo, { value: ao(R.result) })
|
|
4792
4989
|
})] }) : null,
|
|
4793
4990
|
R.error ? /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z(B, {
|
|
4794
4991
|
className: "text-xs text-destructive",
|
|
4795
4992
|
children: "Error"
|
|
4796
4993
|
}), /* @__PURE__ */ Z("div", {
|
|
4797
4994
|
className: "mt-1.5",
|
|
4798
|
-
children: /* @__PURE__ */ Z(
|
|
4995
|
+
children: /* @__PURE__ */ Z(oo, { value: R.error })
|
|
4799
4996
|
})] }) : null,
|
|
4800
4997
|
R.rejection_reason ? /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z(B, {
|
|
4801
4998
|
className: "text-xs",
|
|
@@ -4810,7 +5007,7 @@ function Ja({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4810
5007
|
size: "sm",
|
|
4811
5008
|
onClick: () => void ae(R.id),
|
|
4812
5009
|
disabled: T === R.id,
|
|
4813
|
-
children: [/* @__PURE__ */ Z(
|
|
5010
|
+
children: [/* @__PURE__ */ Z(G, { className: "h-3.5 w-3.5 mr-1" }), "Approve & Execute"]
|
|
4814
5011
|
}), /* @__PURE__ */ Q(v, {
|
|
4815
5012
|
size: "sm",
|
|
4816
5013
|
variant: "destructive",
|
|
@@ -4818,24 +5015,24 @@ function Ja({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4818
5015
|
g(R.id), w("");
|
|
4819
5016
|
},
|
|
4820
5017
|
disabled: T === R.id,
|
|
4821
|
-
children: [/* @__PURE__ */ Z(
|
|
5018
|
+
children: [/* @__PURE__ */ Z(J, { className: "h-3.5 w-3.5 mr-1" }), "Reject"]
|
|
4822
5019
|
})]
|
|
4823
5020
|
}) : null
|
|
4824
5021
|
]
|
|
4825
5022
|
}) : null]
|
|
4826
5023
|
})
|
|
4827
5024
|
}),
|
|
4828
|
-
/* @__PURE__ */ Z(
|
|
5025
|
+
/* @__PURE__ */ Z(me, {
|
|
4829
5026
|
open: !!h,
|
|
4830
5027
|
onOpenChange: (e) => {
|
|
4831
5028
|
e || (g(null), w(""));
|
|
4832
5029
|
},
|
|
4833
|
-
children: /* @__PURE__ */ Q(
|
|
5030
|
+
children: /* @__PURE__ */ Q(he, {
|
|
4834
5031
|
side: "bottom",
|
|
4835
5032
|
className: "max-h-[40vh]",
|
|
4836
|
-
children: [/* @__PURE__ */ Q(
|
|
5033
|
+
children: [/* @__PURE__ */ Q(_e, { children: [/* @__PURE__ */ Z(ve, { children: "Reject this action?" }), /* @__PURE__ */ Z(ge, { children: "The reason is shown back to the AI so it can adjust its next response." })] }), /* @__PURE__ */ Q("div", {
|
|
4837
5034
|
className: "px-4 mt-3 space-y-3",
|
|
4838
|
-
children: [/* @__PURE__ */ Z(
|
|
5035
|
+
children: [/* @__PURE__ */ Z(De, {
|
|
4839
5036
|
value: _,
|
|
4840
5037
|
onChange: (e) => w(e.target.value),
|
|
4841
5038
|
placeholder: "Optional reason (e.g. 'Wrong record id — please confirm with the user first.')",
|
|
@@ -4856,7 +5053,7 @@ function Ja({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4856
5053
|
onClick: () => h && void oe(h, _),
|
|
4857
5054
|
disabled: !h || T === h,
|
|
4858
5055
|
"data-testid": "ai-inbox-reject-confirm",
|
|
4859
|
-
children: [/* @__PURE__ */ Z(
|
|
5056
|
+
children: [/* @__PURE__ */ Z(J, { className: "h-3.5 w-3.5 mr-1" }), "Reject"]
|
|
4860
5057
|
})]
|
|
4861
5058
|
})]
|
|
4862
5059
|
})]
|
|
@@ -4866,14 +5063,14 @@ function Ja({ apiBase: t, headers: n, pollInterval: r = 5e3, conversationId: i,
|
|
|
4866
5063
|
}
|
|
4867
5064
|
//#endregion
|
|
4868
5065
|
//#region src/useHitlInChat.ts
|
|
4869
|
-
function
|
|
5066
|
+
function lo(e) {
|
|
4870
5067
|
return !e || e.length === 0 ? "/api/v1/ai" : e.endsWith("/") ? e.slice(0, -1) : e;
|
|
4871
5068
|
}
|
|
4872
|
-
function
|
|
5069
|
+
function uo(e, t) {
|
|
4873
5070
|
let n = { ...e ?? {} };
|
|
4874
5071
|
return t && (n["Content-Type"] = "application/json"), n;
|
|
4875
5072
|
}
|
|
4876
|
-
async function
|
|
5073
|
+
async function fo(e) {
|
|
4877
5074
|
let t = await e.text();
|
|
4878
5075
|
if (!t) return null;
|
|
4879
5076
|
try {
|
|
@@ -4882,8 +5079,8 @@ async function Za(e) {
|
|
|
4882
5079
|
return { raw: t };
|
|
4883
5080
|
}
|
|
4884
5081
|
}
|
|
4885
|
-
function
|
|
4886
|
-
let { messages: n, apiBase: r, headers: i, onDecided: a, continueConversation: o } = t, s =
|
|
5082
|
+
function po(t) {
|
|
5083
|
+
let { messages: n, apiBase: r, headers: i, onDecided: a, continueConversation: o } = t, s = lo(r), c = e.useMemo(() => {
|
|
4887
5084
|
let e = /* @__PURE__ */ new Map();
|
|
4888
5085
|
for (let t of n) {
|
|
4889
5086
|
let n = t.toolInvocations ?? [];
|
|
@@ -4926,9 +5123,9 @@ function Qa(t) {
|
|
|
4926
5123
|
let r = `${s}/pending-actions/${encodeURIComponent(l)}/${t ? "approve" : "reject"}`, c = t ? "{}" : JSON.stringify({ reason: n ?? "" }), d = await fetch(r, {
|
|
4927
5124
|
method: "POST",
|
|
4928
5125
|
credentials: "include",
|
|
4929
|
-
headers:
|
|
5126
|
+
headers: uo(i, !0),
|
|
4930
5127
|
body: c
|
|
4931
|
-
}), f = await
|
|
5128
|
+
}), f = await fo(d) ?? {};
|
|
4932
5129
|
if (!d.ok) {
|
|
4933
5130
|
let t = typeof f.error == "string" ? f.error : `Approval failed: HTTP ${d.status}`;
|
|
4934
5131
|
m(e, {
|
|
@@ -4961,7 +5158,7 @@ function Qa(t) {
|
|
|
4961
5158
|
message: `Status: ${p}`
|
|
4962
5159
|
}), h = !0;
|
|
4963
5160
|
if (a?.(e, f), h && o) {
|
|
4964
|
-
let r =
|
|
5161
|
+
let r = mo({
|
|
4965
5162
|
approved: t,
|
|
4966
5163
|
status: p,
|
|
4967
5164
|
toolName: u,
|
|
@@ -4997,24 +5194,24 @@ function Qa(t) {
|
|
|
4997
5194
|
isDeciding: f
|
|
4998
5195
|
};
|
|
4999
5196
|
}
|
|
5000
|
-
function
|
|
5197
|
+
function mo(e) {
|
|
5001
5198
|
let { approved: t, status: n, toolName: r, pendingActionId: i, outcome: a, reason: o } = e, s = `[HITL ${i}]`;
|
|
5002
5199
|
if (t && n === "executed") {
|
|
5003
5200
|
let e = a.result;
|
|
5004
|
-
return `${s} The operator approved the \`${r}\` call. It executed successfully with result: ${e == null ? "(no payload)" : typeof e == "string" ? e :
|
|
5201
|
+
return `${s} The operator approved the \`${r}\` call. It executed successfully with result: ${e == null ? "(no payload)" : typeof e == "string" ? e : ho(JSON.stringify(e), 800)}. Acknowledge the outcome concisely and continue the user's task.`;
|
|
5005
5202
|
}
|
|
5006
5203
|
if (!t && n === "rejected") return `${s} The operator rejected the \`${r}\` call.${o && o.trim().length > 0 ? ` Reason: ${o}.` : ""} Acknowledge the rejection and ask whether to try a different approach.`;
|
|
5007
5204
|
if (n === "failed") {
|
|
5008
5205
|
let e = a.error;
|
|
5009
|
-
return `${s} The \`${r}\` call was approved but execution failed: ${typeof e == "string" ? e :
|
|
5206
|
+
return `${s} The \`${r}\` call was approved but execution failed: ${typeof e == "string" ? e : ho(JSON.stringify(e ?? {}), 400)}. Apologize concisely and offer alternatives.`;
|
|
5010
5207
|
}
|
|
5011
5208
|
}
|
|
5012
|
-
function
|
|
5209
|
+
function ho(e, t) {
|
|
5013
5210
|
return e.length <= t ? e : `${e.slice(0, t - 1)}…`;
|
|
5014
5211
|
}
|
|
5015
5212
|
//#endregion
|
|
5016
5213
|
//#region src/index.tsx
|
|
5017
|
-
var
|
|
5214
|
+
var go = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type your message...", onSendMessage: i, disabled: a = !1, showTimestamp: o = !1, userAvatarUrl: s, userAvatarFallback: c = "You", assistantAvatarUrl: l, assistantAvatarFallback: u = "AI", maxHeight: d = "500px", ...f }, p) => {
|
|
5018
5215
|
let [m, h] = e.useState(""), g = e.useRef(null), _ = e.useRef(null);
|
|
5019
5216
|
e.useEffect(() => {
|
|
5020
5217
|
if (g.current) {
|
|
@@ -5029,10 +5226,10 @@ var to = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
5029
5226
|
};
|
|
5030
5227
|
return /* @__PURE__ */ Q("div", {
|
|
5031
5228
|
ref: p,
|
|
5032
|
-
className:
|
|
5229
|
+
className: W("flex flex-col border rounded-lg bg-background overflow-hidden", t),
|
|
5033
5230
|
style: { maxHeight: d },
|
|
5034
5231
|
...f,
|
|
5035
|
-
children: [/* @__PURE__ */ Z(
|
|
5232
|
+
children: [/* @__PURE__ */ Z(se, {
|
|
5036
5233
|
ref: g,
|
|
5037
5234
|
className: "flex-1 p-4",
|
|
5038
5235
|
children: /* @__PURE__ */ Z("div", {
|
|
@@ -5040,7 +5237,7 @@ var to = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
5040
5237
|
children: n.length === 0 ? /* @__PURE__ */ Z("div", {
|
|
5041
5238
|
className: "flex items-center justify-center h-32 text-muted-foreground text-sm",
|
|
5042
5239
|
children: "No messages yet. Start a conversation!"
|
|
5043
|
-
}) : n.map((e) => /* @__PURE__ */ Z(
|
|
5240
|
+
}) : n.map((e) => /* @__PURE__ */ Z(_o, {
|
|
5044
5241
|
message: e,
|
|
5045
5242
|
showTimestamp: o,
|
|
5046
5243
|
userAvatarUrl: s,
|
|
@@ -5065,14 +5262,14 @@ var to = e.forwardRef(({ className: t, messages: n = [], placeholder: r = "Type
|
|
|
5065
5262
|
onClick: y,
|
|
5066
5263
|
disabled: a || !m.trim(),
|
|
5067
5264
|
size: "icon",
|
|
5068
|
-
children: /* @__PURE__ */ Z(
|
|
5265
|
+
children: /* @__PURE__ */ Z(ft, { className: "h-4 w-4" })
|
|
5069
5266
|
})]
|
|
5070
5267
|
})
|
|
5071
5268
|
})]
|
|
5072
5269
|
});
|
|
5073
5270
|
});
|
|
5074
|
-
|
|
5075
|
-
var
|
|
5271
|
+
go.displayName = "Chatbot";
|
|
5272
|
+
var _o = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback: r, assistantAvatarUrl: i, assistantAvatarFallback: a }) => {
|
|
5076
5273
|
let o = e.role === "user";
|
|
5077
5274
|
if (e.role === "system") return /* @__PURE__ */ Z("div", {
|
|
5078
5275
|
className: "flex justify-center",
|
|
@@ -5083,7 +5280,7 @@ var no = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback:
|
|
|
5083
5280
|
});
|
|
5084
5281
|
let s = o ? e.avatar || n : e.avatar || i, c = o ? e.avatarFallback || r : e.avatarFallback || a;
|
|
5085
5282
|
return /* @__PURE__ */ Q("div", {
|
|
5086
|
-
className:
|
|
5283
|
+
className: W("flex gap-3", o ? "flex-row-reverse" : "flex-row"),
|
|
5087
5284
|
children: [/* @__PURE__ */ Q(m, {
|
|
5088
5285
|
className: "h-8 w-8",
|
|
5089
5286
|
children: [/* @__PURE__ */ Z(g, { src: s }), /* @__PURE__ */ Z(h, {
|
|
@@ -5091,9 +5288,9 @@ var no = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback:
|
|
|
5091
5288
|
children: c
|
|
5092
5289
|
})]
|
|
5093
5290
|
}), /* @__PURE__ */ Q("div", {
|
|
5094
|
-
className:
|
|
5291
|
+
className: W("flex flex-col gap-1", o ? "items-end" : "items-start"),
|
|
5095
5292
|
children: [/* @__PURE__ */ Z("div", {
|
|
5096
|
-
className:
|
|
5293
|
+
className: W("rounded-lg px-4 py-2 max-w-[70%] break-words", o ? "bg-primary text-primary-foreground" : "bg-muted"),
|
|
5097
5294
|
children: /* @__PURE__ */ Z("p", {
|
|
5098
5295
|
className: "text-sm whitespace-pre-wrap",
|
|
5099
5296
|
children: e.content
|
|
@@ -5104,9 +5301,9 @@ var no = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback:
|
|
|
5104
5301
|
})]
|
|
5105
5302
|
})]
|
|
5106
5303
|
});
|
|
5107
|
-
},
|
|
5304
|
+
}, vo = e.forwardRef(({ className: e, avatarSrc: t, avatarFallback: n = "AI", ...r }, i) => /* @__PURE__ */ Q("div", {
|
|
5108
5305
|
ref: i,
|
|
5109
|
-
className:
|
|
5306
|
+
className: W("flex gap-3", e),
|
|
5110
5307
|
...r,
|
|
5111
5308
|
children: [/* @__PURE__ */ Q(m, {
|
|
5112
5309
|
className: "h-8 w-8",
|
|
@@ -5126,6 +5323,6 @@ var no = ({ message: e, showTimestamp: t, userAvatarUrl: n, userAvatarFallback:
|
|
|
5126
5323
|
})
|
|
5127
5324
|
})]
|
|
5128
5325
|
}));
|
|
5129
|
-
|
|
5326
|
+
vo.displayName = "TypingIndicator";
|
|
5130
5327
|
//#endregion
|
|
5131
|
-
export {
|
|
5328
|
+
export { Tn as AGENT_ALIAS_GROUPS, Za as AIElements, gn as AI_USAGE_REFRESH_EVENT, co as AiPendingActionsInbox, go as Chatbot, wa as ChatbotEnhanced, Ja as FloatingChatbot, ir as FloatingChatbotPanel, Kn as FloatingChatbotProvider, Qn as FloatingChatbotTrigger, Pn as PLATFORM_DEFAULT_AGENT, vo as TypingIndicator, En as agentAliasGroup, Nn as agentHasCapability, Dn as agentRouteName, mn as authoredToRuntimeMessage, tn as buildProgressFromDraftReview, Zt as detectAuthoringVerdict, Jt as detectBuilderHandoff, Qt as detectBuiltAppPackage, $t as detectDraftResult, Yt as detectProposedChanges, qt as detectProposedPlan, Xt as detectReplayOutcome, _n as emitAiUsageRefresh, or as humanizeToolName, jn as isAskAgent, An as isBuildAgent, kn as isBuiltinAgentName, ca as publishHealthFromResponse, On as resolveAgentParam, Fn as resolveDefaultAgentName, cr as summarizeChatError, hn as toRuntimeMessages, dn as toRuntimeRole, un as toRuntimeTimestamp, pn as toRuntimeToolInvocation, fn as toRuntimeToolState, cn as uiMessageToChatMessage, ln as uiMessagesToChatMessages, sr as unwrapToolResult, Hn as useAgents, Wn as useAiModels, qn as useFloatingChatbot, po as useHitlInChat, wn as useObjectChat, to as usePendingActions };
|