@burdenoff/fe-libs 2026.713.3 → 2026.713.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared/components/assistantWidget/AssistantWidget.d.ts +1 -1
- package/dist/shared/components/assistantWidget/AssistantWidget.d.ts.map +1 -1
- package/dist/shared/components/assistantWidget/AssistantWidget.js +123 -107
- package/dist/shared/components/assistantWidget/types.d.ts +8 -2
- package/dist/shared/components/assistantWidget/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -22,7 +22,7 @@ export interface AssistantWidgetProps {
|
|
|
22
22
|
*/
|
|
23
23
|
layout?: 'floating' | 'sidebar';
|
|
24
24
|
/**
|
|
25
|
-
* Show the conversations rail (New chat /
|
|
25
|
+
* Show the conversations rail (New chat / History, with per-chat delete).
|
|
26
26
|
* Ignored unless the transport actually implements session management —
|
|
27
27
|
* a panel whose buttons do nothing is worse than no panel.
|
|
28
28
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantWidget.d.ts","sourceRoot":"","sources":["../../../../src/shared/components/assistantWidget/AssistantWidget.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAML,KAAK,EAAE,EAER,MAAM,OAAO,CAAC;AAef,OAAO,KAAK,EAA2B,kBAAkB,EAA0B,MAAM,SAAS,CAAC;AAEnG,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,SAAS,EAAE,kBAAkB,CAAC;IAC9B,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAChC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,4EAA4E;IAC5E,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,8EAA8E;AAC9E,eAAO,MAAM,6BAA6B,+BAA+B,CAAC;AAyB1E,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"AssistantWidget.d.ts","sourceRoot":"","sources":["../../../../src/shared/components/assistantWidget/AssistantWidget.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAML,KAAK,EAAE,EAER,MAAM,OAAO,CAAC;AAef,OAAO,KAAK,EAA2B,kBAAkB,EAA0B,MAAM,SAAS,CAAC;AAEnG,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,SAAS,EAAE,kBAAkB,CAAC;IAC9B,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAChC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,4EAA4E;IAC5E,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,8EAA8E;AAC9E,eAAO,MAAM,6BAA6B,+BAA+B,CAAC;AAyB1E,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAwhBpD,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { cn as e } from "../../utils/cn.js";
|
|
2
2
|
import { useVoiceInput as t } from "./useVoiceInput.js";
|
|
3
3
|
import { MessageContent as n } from "./MessageContent.js";
|
|
4
|
-
import { useCallback as r, useEffect as i, useMemo as
|
|
5
|
-
import { History as
|
|
4
|
+
import { useCallback as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
5
|
+
import { History as ee, Loader2 as c, MessageCircle as l, Mic as te, Plus as ne, Send as re, Sparkles as u, Trash2 as ie, X as d } from "lucide-react";
|
|
6
6
|
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
7
7
|
//#region src/shared/components/assistantWidget/AssistantWidget.tsx
|
|
8
8
|
var h = "bf:toggle-assistant-widget", g = "bf:assistant-widget:isOpen";
|
|
@@ -22,13 +22,13 @@ function v(e) {
|
|
|
22
22
|
function y() {
|
|
23
23
|
return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
24
24
|
}
|
|
25
|
-
var b = ({ transport: g, title: b = "AI Assistant", subtitle: x = "Ask me to do things on this screen — I can run them for you.", placeholder:
|
|
26
|
-
let [
|
|
27
|
-
v(!0),
|
|
25
|
+
var b = ({ transport: g, title: b = "AI Assistant", subtitle: x = "Ask me to do things on this screen — I can run them for you.", placeholder: S = "Ask anything, or describe what to create…", launcherClassName: C, voiceLang: w = "en-US", layout: T = "floating", showSessionPanel: ae = !1, onNavigate: oe }) => {
|
|
26
|
+
let [E, D] = s(() => _()), [O, k] = s([]), [A, j] = s(""), [M, N] = s(!1), [P, F] = s(!1), [I, L] = s([]), [R, z] = s(!1), [B, V] = s(!1), H = o(null), U = o(null), W = o(null), G = o(!1), K = T === "sidebar", se = ae && !!g.newSession, q = t(w), J = r(() => {
|
|
27
|
+
v(!0), D(!0);
|
|
28
28
|
}, []), Y = r(() => {
|
|
29
|
-
v(!1),
|
|
29
|
+
v(!1), D(!1);
|
|
30
30
|
}, []), X = r(() => {
|
|
31
|
-
|
|
31
|
+
D((e) => {
|
|
32
32
|
let t = !e;
|
|
33
33
|
return v(t), t;
|
|
34
34
|
});
|
|
@@ -44,77 +44,85 @@ var b = ({ transport: g, title: b = "AI Assistant", subtitle: x = "Ask me to do
|
|
|
44
44
|
Y,
|
|
45
45
|
X
|
|
46
46
|
]), i(() => {
|
|
47
|
-
q.isListening && q.transcript &&
|
|
47
|
+
q.isListening && q.transcript && j(q.transcript);
|
|
48
48
|
}, [q.transcript, q.isListening]), i(() => {
|
|
49
|
-
if (!
|
|
49
|
+
if (!E || G.current) return;
|
|
50
50
|
let e = g.loadHistory;
|
|
51
51
|
if (!e) {
|
|
52
|
-
|
|
52
|
+
G.current = !0;
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
G.current = !0;
|
|
56
56
|
let t = !1;
|
|
57
|
-
return
|
|
57
|
+
return F(!0), (async () => {
|
|
58
58
|
try {
|
|
59
59
|
let n = await e();
|
|
60
|
-
!t && n.length > 0 &&
|
|
60
|
+
!t && n.length > 0 && k((e) => e.length === 0 ? n : e);
|
|
61
61
|
} catch {} finally {
|
|
62
|
-
t ||
|
|
62
|
+
t || F(!1);
|
|
63
63
|
}
|
|
64
64
|
})(), () => {
|
|
65
65
|
t = !0;
|
|
66
66
|
};
|
|
67
|
-
}, [
|
|
68
|
-
|
|
69
|
-
}, [
|
|
67
|
+
}, [E, g]), i(() => {
|
|
68
|
+
E && U.current && (U.current.scrollTop = U.current.scrollHeight);
|
|
69
|
+
}, [O, E]);
|
|
70
70
|
let Z = r((e, t) => {
|
|
71
|
-
|
|
71
|
+
k((n) => n.map((n) => n.id === e ? {
|
|
72
72
|
...n,
|
|
73
73
|
...t
|
|
74
74
|
} : n));
|
|
75
75
|
}, []), Q = r(async () => {
|
|
76
|
-
if (g.listSessions)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
if (g.listSessions) {
|
|
77
|
+
V(!0);
|
|
78
|
+
try {
|
|
79
|
+
L(await g.listSessions());
|
|
80
|
+
} catch {
|
|
81
|
+
L([]);
|
|
82
|
+
} finally {
|
|
83
|
+
V(!1);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, [g]), ce = r(async () => {
|
|
87
|
+
!g.newSession || M || (k([]), j(""), z(!1), await g.newSession());
|
|
88
|
+
}, [g, M]), le = r(async (e, t) => {
|
|
89
|
+
if (!(!g.deleteSession || M)) {
|
|
90
|
+
L((t) => t.filter((t) => t.id !== e)), t && (k([]), j(""));
|
|
91
|
+
try {
|
|
92
|
+
await g.deleteSession(e);
|
|
93
|
+
} finally {
|
|
94
|
+
Q();
|
|
95
|
+
}
|
|
80
96
|
}
|
|
81
|
-
}, [g]), oe = r(async () => {
|
|
82
|
-
!g.newSession || N || (await g.newSession(), A([]), M(""), Q());
|
|
83
|
-
}, [
|
|
84
|
-
g,
|
|
85
|
-
N,
|
|
86
|
-
Q
|
|
87
|
-
]), se = r(async () => {
|
|
88
|
-
!g.clearSession || N || (await g.clearSession(), A([]), M(""), Q());
|
|
89
97
|
}, [
|
|
90
98
|
g,
|
|
91
|
-
|
|
99
|
+
M,
|
|
92
100
|
Q
|
|
93
|
-
]),
|
|
94
|
-
|
|
95
|
-
}, [Q]),
|
|
96
|
-
if (!(!g.selectSession ||
|
|
97
|
-
|
|
101
|
+
]), ue = r(() => {
|
|
102
|
+
z((e) => (e || Q(), !e));
|
|
103
|
+
}, [Q]), de = r(async (e) => {
|
|
104
|
+
if (!(!g.selectSession || M)) {
|
|
105
|
+
F(!0);
|
|
98
106
|
try {
|
|
99
|
-
|
|
107
|
+
k(await g.selectSession(e)), z(!1), Q();
|
|
100
108
|
} catch {} finally {
|
|
101
|
-
|
|
109
|
+
F(!1);
|
|
102
110
|
}
|
|
103
111
|
}
|
|
104
112
|
}, [
|
|
105
113
|
g,
|
|
106
|
-
|
|
114
|
+
M,
|
|
107
115
|
Q
|
|
108
116
|
]), $ = r(async () => {
|
|
109
|
-
let e =
|
|
110
|
-
if (!e ||
|
|
111
|
-
q.isListening && q.stop(), q.reset(),
|
|
117
|
+
let e = A.trim();
|
|
118
|
+
if (!e || M) return;
|
|
119
|
+
q.isListening && q.stop(), q.reset(), j(""), H.current && (H.current.style.height = "auto");
|
|
112
120
|
let t = {
|
|
113
121
|
id: y(),
|
|
114
122
|
role: "user",
|
|
115
123
|
content: e
|
|
116
124
|
}, n = y();
|
|
117
|
-
|
|
125
|
+
k((e) => [
|
|
118
126
|
...e,
|
|
119
127
|
t,
|
|
120
128
|
{
|
|
@@ -123,9 +131,9 @@ var b = ({ transport: g, title: b = "AI Assistant", subtitle: x = "Ask me to do
|
|
|
123
131
|
content: "",
|
|
124
132
|
pending: !0
|
|
125
133
|
}
|
|
126
|
-
]),
|
|
134
|
+
]), N(!0);
|
|
127
135
|
let r = new AbortController();
|
|
128
|
-
|
|
136
|
+
W.current = r;
|
|
129
137
|
try {
|
|
130
138
|
let { text: t } = await g.sendPrompt({
|
|
131
139
|
prompt: e,
|
|
@@ -143,83 +151,91 @@ var b = ({ transport: g, title: b = "AI Assistant", subtitle: x = "Ask me to do
|
|
|
143
151
|
error: !0
|
|
144
152
|
});
|
|
145
153
|
} finally {
|
|
146
|
-
|
|
154
|
+
N(!1), W.current = null, R && Q();
|
|
147
155
|
}
|
|
148
156
|
}, [
|
|
149
|
-
|
|
150
|
-
|
|
157
|
+
A,
|
|
158
|
+
M,
|
|
151
159
|
Z,
|
|
152
160
|
g,
|
|
153
161
|
q,
|
|
154
|
-
|
|
162
|
+
R,
|
|
155
163
|
Q
|
|
156
|
-
]),
|
|
164
|
+
]), fe = r((e) => {
|
|
157
165
|
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), $());
|
|
158
|
-
}, [$]),
|
|
159
|
-
let e =
|
|
166
|
+
}, [$]), pe = r(() => {
|
|
167
|
+
let e = H.current;
|
|
160
168
|
e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, 120)}px`);
|
|
161
|
-
}, []),
|
|
169
|
+
}, []), me = r(() => {
|
|
162
170
|
q.isListening ? q.stop() : q.start();
|
|
163
171
|
}, [q]);
|
|
164
|
-
return /* @__PURE__ */ m(f, { children: [
|
|
172
|
+
return /* @__PURE__ */ m(f, { children: [a(() => /* @__PURE__ */ p("button", {
|
|
165
173
|
type: "button",
|
|
166
174
|
onClick: X,
|
|
167
|
-
"aria-label":
|
|
168
|
-
"aria-expanded":
|
|
175
|
+
"aria-label": E ? "Close AI assistant" : "Open AI assistant",
|
|
176
|
+
"aria-expanded": E,
|
|
169
177
|
"data-testid": "assistant-widget-launcher",
|
|
170
|
-
className: e("fixed bottom-6 right-6 z-[100] inline-flex size-14 items-center justify-center rounded-full", "bg-action-primary-bg text-action-primary-text shadow-xl transition-transform duration-200", "hover:scale-105 hover:bg-action-primary-bg-hover focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong cursor-pointer",
|
|
171
|
-
children: p(
|
|
178
|
+
className: e("fixed bottom-6 right-6 z-[100] inline-flex size-14 items-center justify-center rounded-full", "bg-action-primary-bg text-action-primary-text shadow-xl transition-transform duration-200", "hover:scale-105 hover:bg-action-primary-bg-hover focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong cursor-pointer", C),
|
|
179
|
+
children: p(E ? d : u, { className: "size-6" })
|
|
172
180
|
}), [
|
|
173
|
-
|
|
181
|
+
E,
|
|
174
182
|
X,
|
|
175
|
-
|
|
176
|
-
]),
|
|
183
|
+
C
|
|
184
|
+
]), E ? /* @__PURE__ */ m("div", {
|
|
177
185
|
role: "dialog",
|
|
178
186
|
"aria-label": b,
|
|
179
187
|
"data-testid": "assistant-widget-window",
|
|
180
|
-
"data-layout":
|
|
181
|
-
className: e("fixed z-[100] flex overflow-hidden border-border-default bg-bg-surface shadow-2xl",
|
|
182
|
-
children: [
|
|
188
|
+
"data-layout": T,
|
|
189
|
+
className: e("fixed z-[100] flex overflow-hidden border-border-default bg-bg-surface shadow-2xl", K ? "inset-y-0 right-0 h-screen w-full border-l sm:w-[480px] lg:w-[560px] animate-in slide-in-from-right duration-200" : "flex-col rounded-xl border bottom-24 right-6 h-[560px] max-h-[calc(100vh-7rem)] w-[calc(100vw-3rem)] sm:w-[400px] animate-in slide-in-from-bottom-2 fade-in duration-200"),
|
|
190
|
+
children: [K && se ? /* @__PURE__ */ m("aside", {
|
|
183
191
|
"data-testid": "assistant-session-panel",
|
|
184
192
|
className: "flex w-[168px] shrink-0 flex-col gap-1 border-r border-border-subtle bg-bg-sunken p-2",
|
|
185
193
|
children: [
|
|
186
194
|
/* @__PURE__ */ m("button", {
|
|
187
195
|
type: "button",
|
|
188
|
-
onClick: () => void
|
|
189
|
-
disabled:
|
|
196
|
+
onClick: () => void ce(),
|
|
197
|
+
disabled: M,
|
|
190
198
|
"data-testid": "assistant-new-chat",
|
|
191
199
|
className: "flex items-center gap-2 rounded-md px-2 py-2 text-xs font-medium text-text-primary transition-colors hover:bg-bg-surface disabled:opacity-50 cursor-pointer",
|
|
192
|
-
children: [/* @__PURE__ */ p(
|
|
200
|
+
children: [/* @__PURE__ */ p(ne, { className: "size-4 shrink-0" }), "New chat"]
|
|
193
201
|
}),
|
|
194
202
|
/* @__PURE__ */ m("button", {
|
|
195
203
|
type: "button",
|
|
196
|
-
onClick:
|
|
197
|
-
|
|
198
|
-
"data-testid": "assistant-clear-chat",
|
|
199
|
-
className: "flex items-center gap-2 rounded-md px-2 py-2 text-xs font-medium text-text-primary transition-colors hover:bg-bg-surface disabled:opacity-50 cursor-pointer",
|
|
200
|
-
children: [/* @__PURE__ */ p(u, { className: "size-4 shrink-0" }), "Clear chat"]
|
|
201
|
-
}),
|
|
202
|
-
/* @__PURE__ */ m("button", {
|
|
203
|
-
type: "button",
|
|
204
|
-
onClick: ce,
|
|
205
|
-
"aria-expanded": z,
|
|
204
|
+
onClick: ue,
|
|
205
|
+
"aria-expanded": R,
|
|
206
206
|
"data-testid": "assistant-history-toggle",
|
|
207
207
|
className: "flex items-center gap-2 rounded-md px-2 py-2 text-xs font-medium text-text-primary transition-colors hover:bg-bg-surface cursor-pointer",
|
|
208
|
-
children: [/* @__PURE__ */ p(
|
|
208
|
+
children: [/* @__PURE__ */ p(ee, { className: "size-4 shrink-0" }), "History"]
|
|
209
209
|
}),
|
|
210
|
-
|
|
210
|
+
R ? /* @__PURE__ */ p("div", {
|
|
211
211
|
"data-testid": "assistant-history-list",
|
|
212
212
|
className: "mt-1 flex-1 space-y-0.5 overflow-y-auto border-t border-border-subtle pt-2",
|
|
213
|
-
children:
|
|
213
|
+
children: B && I.length === 0 ? /* @__PURE__ */ m("p", {
|
|
214
|
+
className: "flex items-center gap-1.5 px-2 py-1 text-[11px] text-text-muted",
|
|
215
|
+
children: [/* @__PURE__ */ p(c, { className: "size-3 animate-spin" }), "Loading…"]
|
|
216
|
+
}) : I.length === 0 ? /* @__PURE__ */ p("p", {
|
|
214
217
|
className: "px-2 py-1 text-[11px] leading-relaxed text-text-muted",
|
|
215
218
|
children: "No past chats yet."
|
|
216
|
-
}) :
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
219
|
+
}) : I.map((t) => /* @__PURE__ */ m("div", {
|
|
220
|
+
"data-testid": "assistant-history-row",
|
|
221
|
+
className: e("group flex items-center gap-1 rounded pr-1 transition-colors", t.active ? "bg-bg-surface" : "hover:bg-bg-surface"),
|
|
222
|
+
children: [/* @__PURE__ */ p("button", {
|
|
223
|
+
type: "button",
|
|
224
|
+
onClick: () => void de(t.id),
|
|
225
|
+
title: t.title,
|
|
226
|
+
"data-testid": "assistant-history-item",
|
|
227
|
+
className: e("min-w-0 flex-1 truncate rounded px-2 py-1.5 text-left text-[11px] leading-relaxed cursor-pointer", t.active ? "font-medium text-text-primary" : "text-text-secondary group-hover:text-text-primary"),
|
|
228
|
+
children: t.title
|
|
229
|
+
}), g.deleteSession ? /* @__PURE__ */ p("button", {
|
|
230
|
+
type: "button",
|
|
231
|
+
onClick: () => void le(t.id, !!t.active),
|
|
232
|
+
disabled: M,
|
|
233
|
+
"aria-label": `Delete chat: ${t.title}`,
|
|
234
|
+
title: "Delete this chat",
|
|
235
|
+
"data-testid": "assistant-delete-chat",
|
|
236
|
+
className: "inline-flex size-6 shrink-0 items-center justify-center rounded text-text-muted opacity-0 transition-opacity hover:text-status-error-bg focus-visible:opacity-100 group-hover:opacity-100 disabled:opacity-30 cursor-pointer",
|
|
237
|
+
children: /* @__PURE__ */ p(ie, { className: "size-3.5" })
|
|
238
|
+
}) : null]
|
|
223
239
|
}, t.id))
|
|
224
240
|
}) : null
|
|
225
241
|
]
|
|
@@ -232,7 +248,7 @@ var b = ({ transport: g, title: b = "AI Assistant", subtitle: x = "Ask me to do
|
|
|
232
248
|
className: "flex min-w-0 items-center gap-2",
|
|
233
249
|
children: [/* @__PURE__ */ p("span", {
|
|
234
250
|
className: "inline-flex size-7 shrink-0 items-center justify-center rounded-full bg-action-primary-bg/10 text-action-primary-bg",
|
|
235
|
-
children: /* @__PURE__ */ p(
|
|
251
|
+
children: /* @__PURE__ */ p(u, { className: "size-4" })
|
|
236
252
|
}), /* @__PURE__ */ p("h2", {
|
|
237
253
|
className: "truncate text-sm font-semibold text-text-primary",
|
|
238
254
|
children: b
|
|
@@ -247,37 +263,37 @@ var b = ({ transport: g, title: b = "AI Assistant", subtitle: x = "Ask me to do
|
|
|
247
263
|
})]
|
|
248
264
|
}),
|
|
249
265
|
/* @__PURE__ */ p("div", {
|
|
250
|
-
ref:
|
|
266
|
+
ref: U,
|
|
251
267
|
className: "flex-1 space-y-3 overflow-y-auto px-4 py-4",
|
|
252
268
|
"data-testid": "assistant-widget-messages",
|
|
253
|
-
children:
|
|
269
|
+
children: O.length === 0 && P ? /* @__PURE__ */ m("div", {
|
|
254
270
|
"data-testid": "assistant-widget-restoring",
|
|
255
271
|
className: "flex h-full flex-col items-center justify-center gap-3 text-center",
|
|
256
|
-
children: [/* @__PURE__ */ p(
|
|
272
|
+
children: [/* @__PURE__ */ p(c, { className: "size-5 animate-spin text-text-secondary" }), /* @__PURE__ */ p("p", {
|
|
257
273
|
className: "text-xs leading-relaxed text-text-secondary",
|
|
258
274
|
children: "Restoring your conversation…"
|
|
259
275
|
})]
|
|
260
|
-
}) :
|
|
276
|
+
}) : O.length === 0 ? /* @__PURE__ */ m("div", {
|
|
261
277
|
className: "flex h-full flex-col items-center justify-center gap-3 text-center",
|
|
262
278
|
children: [/* @__PURE__ */ p("span", {
|
|
263
279
|
className: "inline-flex size-12 items-center justify-center rounded-full bg-bg-sunken text-action-primary-bg",
|
|
264
|
-
children: /* @__PURE__ */ p(
|
|
280
|
+
children: /* @__PURE__ */ p(l, { className: "size-6" })
|
|
265
281
|
}), /* @__PURE__ */ p("p", {
|
|
266
282
|
className: "max-w-[16rem] text-xs leading-relaxed text-text-secondary",
|
|
267
283
|
children: x
|
|
268
284
|
})]
|
|
269
|
-
}) :
|
|
285
|
+
}) : O.map((t) => /* @__PURE__ */ p("div", {
|
|
270
286
|
className: e("flex", t.role === "user" ? "justify-end" : "justify-start"),
|
|
271
287
|
children: /* @__PURE__ */ m("div", {
|
|
272
288
|
"data-testid": `assistant-widget-message-${t.role}`,
|
|
273
|
-
className: e("whitespace-pre-wrap break-words rounded-lg px-3 py-2 text-xs leading-relaxed",
|
|
289
|
+
className: e("whitespace-pre-wrap break-words rounded-lg px-3 py-2 text-xs leading-relaxed", K ? "max-w-[92%]" : "max-w-[85%]", t.role === "user" ? "bg-action-primary-bg text-action-primary-text" : t.error ? "bg-status-error-bg/10 text-status-error-bg" : "bg-bg-sunken text-text-primary"),
|
|
274
290
|
children: [t.content ? /* @__PURE__ */ p(n, {
|
|
275
291
|
content: t.content,
|
|
276
|
-
onNavigate:
|
|
292
|
+
onNavigate: oe
|
|
277
293
|
}) : null, t.pending ? /* @__PURE__ */ m("span", {
|
|
278
294
|
"data-testid": "assistant-widget-working",
|
|
279
295
|
className: e("inline-flex items-center gap-1 text-text-secondary", t.content ? "mt-1" : ""),
|
|
280
|
-
children: [/* @__PURE__ */ p(
|
|
296
|
+
children: [/* @__PURE__ */ p(c, { className: "size-3 animate-spin" }), t.content ? null : /* @__PURE__ */ p("span", { children: "Working on it…" })]
|
|
281
297
|
}) : null]
|
|
282
298
|
})
|
|
283
299
|
}, t.id))
|
|
@@ -287,21 +303,21 @@ var b = ({ transport: g, title: b = "AI Assistant", subtitle: x = "Ask me to do
|
|
|
287
303
|
children: [
|
|
288
304
|
q.isSupported ? /* @__PURE__ */ p("button", {
|
|
289
305
|
type: "button",
|
|
290
|
-
onClick:
|
|
306
|
+
onClick: me,
|
|
291
307
|
"aria-label": q.isListening ? "Stop voice input" : "Start voice input",
|
|
292
308
|
"aria-pressed": q.isListening,
|
|
293
309
|
"data-testid": "assistant-widget-mic",
|
|
294
310
|
className: e("flex size-9 shrink-0 items-center justify-center rounded-lg transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong cursor-pointer", q.isListening ? "animate-pulse bg-status-error-bg text-action-primary-text" : "bg-bg-sunken text-text-secondary hover:text-text-primary"),
|
|
295
|
-
children: /* @__PURE__ */ p(
|
|
311
|
+
children: /* @__PURE__ */ p(te, { className: "size-4" })
|
|
296
312
|
}) : null,
|
|
297
313
|
/* @__PURE__ */ p("textarea", {
|
|
298
|
-
ref:
|
|
299
|
-
value:
|
|
300
|
-
onChange: (e) =>
|
|
301
|
-
onKeyDown:
|
|
302
|
-
onInput:
|
|
314
|
+
ref: H,
|
|
315
|
+
value: A,
|
|
316
|
+
onChange: (e) => j(e.target.value),
|
|
317
|
+
onKeyDown: fe,
|
|
318
|
+
onInput: pe,
|
|
303
319
|
rows: 1,
|
|
304
|
-
placeholder:
|
|
320
|
+
placeholder: S,
|
|
305
321
|
"aria-label": "Message the assistant",
|
|
306
322
|
"data-testid": "assistant-widget-input",
|
|
307
323
|
className: "flex-1 resize-none rounded-lg border border-border-default bg-bg-sunken px-3 py-2 text-xs leading-relaxed text-text-primary placeholder:text-text-muted focus:border-action-primary-bg focus:outline-none"
|
|
@@ -309,11 +325,11 @@ var b = ({ transport: g, title: b = "AI Assistant", subtitle: x = "Ask me to do
|
|
|
309
325
|
/* @__PURE__ */ p("button", {
|
|
310
326
|
type: "button",
|
|
311
327
|
onClick: () => void $(),
|
|
312
|
-
disabled:
|
|
328
|
+
disabled: M || A.trim().length === 0,
|
|
313
329
|
"aria-label": "Send message",
|
|
314
330
|
"data-testid": "assistant-widget-send",
|
|
315
331
|
className: "flex size-9 shrink-0 items-center justify-center rounded-lg bg-action-primary-bg text-action-primary-text transition-colors hover:bg-action-primary-bg-hover focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:opacity-50 cursor-pointer",
|
|
316
|
-
children:
|
|
332
|
+
children: M ? /* @__PURE__ */ p(c, { className: "size-4 animate-spin" }) : /* @__PURE__ */ p(re, { className: "size-4" })
|
|
317
333
|
})
|
|
318
334
|
]
|
|
319
335
|
})
|
|
@@ -50,8 +50,14 @@ export interface AssistantTransport {
|
|
|
50
50
|
listSessions?: () => Promise<AssistantSessionSummary[]>;
|
|
51
51
|
/** Start an empty conversation and make it active. */
|
|
52
52
|
newSession?: () => Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Delete one conversation by id.
|
|
55
|
+
*
|
|
56
|
+
* Replaces a blanket "clear chat", which could only ever remove whichever chat
|
|
57
|
+
* happened to be open — ambiguous, and useless for tidying up an old one. A
|
|
58
|
+
* delete control on each history row says exactly what it will remove.
|
|
59
|
+
*/
|
|
60
|
+
deleteSession?: (sessionId: string) => Promise<void>;
|
|
55
61
|
/** Switch to a past conversation; returns its messages. */
|
|
56
62
|
selectSession?: (sessionId: string) => Promise<AssistantWidgetMessage[]>;
|
|
57
63
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/shared/components/assistantWidget/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,WAAW,CAAC;AAEvD,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,mBAAmB,CAAC;IAC1B,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yDAAyD;IACzD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,8DAA8D;IAC9D,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;;GAGG;AACH,mDAAmD;AACnD,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAOnE,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAAC;IACxD,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/shared/components/assistantWidget/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,WAAW,CAAC;AAEvD,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,mBAAmB,CAAC;IAC1B,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yDAAyD;IACzD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,8DAA8D;IAC9D,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;;GAGG;AACH,mDAAmD;AACnD,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAOnE,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAAC;IACxD,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,2DAA2D;IAC3D,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC;IACzE;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC;CACvD"}
|