@burdenoff/fe-libs 2026.1113.3 → 2026.1113.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/assistant/askAbout/AskAboutLayer.js +150 -56
- package/dist/shared/assistant/askAbout/askAboutStore.d.ts +23 -1
- package/dist/shared/assistant/askAbout/askAboutStore.js +26 -3
- package/dist/shared/assistant/askAbout/askableSelection.d.ts +2 -0
- package/dist/shared/assistant/askAbout/askableSelection.js +2 -1
- package/dist/shared/assistant/askAbout/focus.d.ts +11 -0
- package/dist/shared/assistant/askAbout/focus.js +40 -28
- package/dist/shared/assistant/askAbout/hint.d.ts +18 -0
- package/dist/shared/assistant/askAbout/hint.js +22 -0
- package/dist/shared/assistant/askAbout/useAskable.d.ts +10 -0
- package/dist/shared/assistant/askAbout/useAskable.js +73 -53
- package/dist/shared/assistant/i18nManifest.d.ts +2 -0
- package/dist/shared/assistant/i18nManifest.js +2 -0
- package/dist/shared/assistant/index.d.ts +1 -0
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +285 -272
- package/dist/shared/assistant/ui/composer/AssistantFocusChip.d.ts +10 -2
- package/dist/shared/assistant/ui/composer/AssistantFocusChip.js +30 -11
- package/dist/shared-assistant.js +305 -304
- package/package.json +1 -1
|
@@ -8,113 +8,118 @@ import { useAssistantStore as a } from "../../store.js";
|
|
|
8
8
|
import { useVoiceInput as te } from "../../voice/useVoiceInput.js";
|
|
9
9
|
import { useAssistantAttachments as ne } from "../../useAssistantAttachments.js";
|
|
10
10
|
import { getSendableAttachments as re } from "../../attachments.js";
|
|
11
|
-
import { ATTACHMENT_COMMIT_CODES as
|
|
12
|
-
import { AssistantAttachmentButton as
|
|
13
|
-
import { AssistantAttachmentChips as
|
|
14
|
-
import { AssistantFocusChip as
|
|
15
|
-
import { useAskAboutStore as
|
|
11
|
+
import { ATTACHMENT_COMMIT_CODES as ie } from "../../attachmentCommit.js";
|
|
12
|
+
import { AssistantAttachmentButton as ae } from "./AssistantAttachmentButton.js";
|
|
13
|
+
import { AssistantAttachmentChips as oe } from "./AssistantAttachmentChips.js";
|
|
14
|
+
import { AssistantFocusChip as se } from "./AssistantFocusChip.js";
|
|
15
|
+
import { useAskAboutStore as o } from "../../askAbout/askAboutStore.js";
|
|
16
16
|
import { AssistantVoiceButton as ce, ListeningDot as le } from "./AssistantVoiceButton.js";
|
|
17
17
|
import { AssistantVoiceSessionButton as ue } from "../voice/AssistantVoiceSessionButton.js";
|
|
18
18
|
import { AssistantModeSelector as de } from "./AssistantModeSelector.js";
|
|
19
19
|
import { AssistantModeMenu as fe } from "./AssistantModeMenu.js";
|
|
20
20
|
import { AssistantViewSwitchRow as pe } from "../compact/AssistantViewSwitchRow.js";
|
|
21
21
|
import { compactEnterSends as me, isImeComposingEnter as he } from "./imeEnter.js";
|
|
22
|
-
import { useCallback as s, useEffect as c, useId as l, useLayoutEffect as
|
|
23
|
-
import { ArrowUp as
|
|
24
|
-
import { Fragment as
|
|
22
|
+
import { useCallback as s, useEffect as c, useId as l, useLayoutEffect as u, useMemo as ge, useRef as d, useState as f } from "react";
|
|
23
|
+
import { ArrowUp as _e, Loader2 as p, Square as ve } from "lucide-react";
|
|
24
|
+
import { Fragment as ye, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
25
25
|
// src/shared/assistant/ui/composer/AssistantComposer.tsx
|
|
26
|
-
var
|
|
27
|
-
function
|
|
26
|
+
var be = 200;
|
|
27
|
+
function xe(e) {
|
|
28
28
|
if (!e) return !1;
|
|
29
29
|
let t = e.ownerDocument.activeElement;
|
|
30
30
|
return !t || t === e.ownerDocument.body ? !1 : e.contains(t) ? !0 : e.closest("[data-assistant-panel]")?.contains(t) ?? !1;
|
|
31
31
|
}
|
|
32
|
-
var
|
|
33
|
-
let
|
|
34
|
-
|
|
35
|
-
}, [
|
|
36
|
-
|
|
37
|
-
let
|
|
32
|
+
var Se = ({ children: e }) => e(l()), g = ({ writeAccessDenied: l = !1, onSend: g, disabled: Ce = !1, readOnly: we = !1, placeholder: Te, mode: Ee, availableModes: _, attachmentCharsPerFile: De, onModeChange: Oe, auto: ke, onStartVoiceSession: v, onDraftStart: Ae, onDraftChange: je, suspendDictation: Me = !1, onVoiceStateChange: Ne, presentation: Pe = "classic", turnInFlight: y = !1, onStop: b, turnId: Fe, modeDisabledReason: Ie = null, inputRef: x, aboveCard: Le, viewSwitch: Re, modeReadOnly: ze = !1, voiceSessionActive: S = !1 }) => {
|
|
33
|
+
let C = r(), { locale: w } = n(), T = Ce || we, E = Pe === "compact", D = d(null), Be = s((e) => {
|
|
34
|
+
D.current = e, typeof x == "function" ? x(e) : x && (x.current = e);
|
|
35
|
+
}, [x]), [O, k] = f(""), [A, j] = f(!1), [M, Ve] = f(!1), N = d(!1), [He, P] = f(null), [Ue, F] = f(null), [I, L] = f(null), [We, Ge] = f(y);
|
|
36
|
+
We === y ? I !== null && y && Fe != null && Fe !== I && L(null) : (Ge(y), y ? (F(null), L(null)) : I !== null && (F(I), L(null)));
|
|
37
|
+
let Ke = d(!1), R = d(null), qe = d(!1), Je = d(!1), Ye = d(null), z = d(!1), B = d(0), { attachments: V, isBusy: Xe, preparingCount: Ze, sendBlocker: Qe, rejection: $e, addFiles: H, remove: et, retry: tt, clear: nt, clearRejection: rt, canAddMore: it, commit: at, cancelCommit: ot } = ne({ perFileChars: De }), U = O.trim() !== "" || V.length > 0, st = d(!1), ct = d(!1);
|
|
38
38
|
c(() => {
|
|
39
|
-
|
|
40
|
-
}, [
|
|
41
|
-
|
|
42
|
-
text:
|
|
43
|
-
hasAttachments:
|
|
44
|
-
dictated:
|
|
39
|
+
U && !st.current ? (st.current = !0, Ae?.()) : U || (st.current = !1);
|
|
40
|
+
}, [U, Ae]), c(() => {
|
|
41
|
+
U || (ct.current = !1), je?.({
|
|
42
|
+
text: O,
|
|
43
|
+
hasAttachments: V.length > 0,
|
|
44
|
+
dictated: ct.current
|
|
45
45
|
});
|
|
46
46
|
}, [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
O,
|
|
48
|
+
V.length,
|
|
49
|
+
U,
|
|
50
50
|
je
|
|
51
51
|
]);
|
|
52
|
-
let
|
|
53
|
-
|
|
54
|
-
}, []),
|
|
55
|
-
onFinalize:
|
|
56
|
-
language:
|
|
57
|
-
}),
|
|
52
|
+
let lt = s((e) => {
|
|
53
|
+
ct.current = !0, k((t) => t ? `${t.replace(/\s+$/, "")} ${e}` : e);
|
|
54
|
+
}, []), ut = a((e) => e.assistantLanguage), dt = ge(() => ee(ut, w), [ut, w]), W = te({
|
|
55
|
+
onFinalize: lt,
|
|
56
|
+
language: dt.tag
|
|
57
|
+
}), G = W.isActive, ft = W.interim, pt = W.stop;
|
|
58
58
|
c(() => {
|
|
59
|
-
Me &&
|
|
59
|
+
Me && G && (ft.trim() !== "" && lt(ft.trim()), pt());
|
|
60
60
|
}, [
|
|
61
61
|
Me,
|
|
62
|
-
|
|
63
|
-
dt,
|
|
62
|
+
G,
|
|
64
63
|
ft,
|
|
65
|
-
|
|
64
|
+
pt,
|
|
65
|
+
lt
|
|
66
66
|
]), c(() => {
|
|
67
67
|
Ne?.({
|
|
68
|
-
committing:
|
|
69
|
-
dictating:
|
|
68
|
+
committing: M,
|
|
69
|
+
dictating: G
|
|
70
70
|
});
|
|
71
71
|
}, [
|
|
72
72
|
Ne,
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
M,
|
|
74
|
+
G
|
|
75
75
|
]);
|
|
76
|
-
let
|
|
76
|
+
let mt = o((e) => e.pending), ht = mt ? C("askAbout.placeholder", "Ask about {{name}}…", { name: mt.label }) : Te ?? C("composer.placeholder", "Ask me anything…"), gt = o((e) => e.focusRequested), _t = (e) => {
|
|
77
|
+
k(e), requestAnimationFrame(() => {
|
|
78
|
+
let t = D.current;
|
|
79
|
+
t && (t.focus({ preventScroll: !0 }), t.setSelectionRange(e.length, e.length));
|
|
80
|
+
});
|
|
81
|
+
};
|
|
77
82
|
c(() => {
|
|
78
|
-
if (!
|
|
79
|
-
let e =
|
|
80
|
-
e && (e.focus({ preventScroll: !0 }),
|
|
81
|
-
}, [
|
|
82
|
-
let
|
|
83
|
-
|
|
84
|
-
let Y =
|
|
83
|
+
if (!gt || T) return;
|
|
84
|
+
let e = D.current;
|
|
85
|
+
e && (e.focus({ preventScroll: !0 }), o.getState().actions.composerFocused());
|
|
86
|
+
}, [gt, T]);
|
|
87
|
+
let K = O.trim(), q = re(V), vt = V.filter((e) => e.status === "error"), J = (K.length > 0 || q.length > 0) && !T && !M && Qe === null, yt = q.some((e) => !(e.fileId && e.downloadUrl) && !e.inlineOnly), bt = d(T);
|
|
88
|
+
bt.current = T;
|
|
89
|
+
let Y = d(!0);
|
|
85
90
|
c(() => (Y.current = !0, () => {
|
|
86
91
|
Y.current = !1;
|
|
87
|
-
}), []),
|
|
88
|
-
let e =
|
|
89
|
-
e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight,
|
|
90
|
-
}, [
|
|
92
|
+
}), []), u(() => {
|
|
93
|
+
let e = D.current;
|
|
94
|
+
e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, be)}px`);
|
|
95
|
+
}, [O]);
|
|
91
96
|
let X = s(async () => {
|
|
92
|
-
if (!J ||
|
|
93
|
-
|
|
94
|
-
let e =
|
|
95
|
-
|
|
96
|
-
let t =
|
|
97
|
-
if (!
|
|
98
|
-
|
|
97
|
+
if (!J || N.current) return;
|
|
98
|
+
W.isActive && W.stop();
|
|
99
|
+
let e = O.trim();
|
|
100
|
+
P(null);
|
|
101
|
+
let t = E && xe(Ye.current);
|
|
102
|
+
if (!yt) {
|
|
103
|
+
z.current = t, g(e, q), k(""), nt();
|
|
99
104
|
return;
|
|
100
105
|
}
|
|
101
106
|
let n = a.getState().activeConversationId;
|
|
102
|
-
|
|
107
|
+
N.current = !0, Ve(!0);
|
|
103
108
|
try {
|
|
104
|
-
let r = await
|
|
109
|
+
let r = await at();
|
|
105
110
|
if (!Y.current) {
|
|
106
111
|
r.ok && await r.rollback();
|
|
107
112
|
return;
|
|
108
113
|
}
|
|
109
114
|
if (!r.ok) {
|
|
110
|
-
r.cancelled ||
|
|
115
|
+
r.cancelled || P({
|
|
111
116
|
kind: "failed",
|
|
112
117
|
failures: r.failures
|
|
113
118
|
});
|
|
114
119
|
return;
|
|
115
120
|
}
|
|
116
|
-
if (
|
|
117
|
-
await r.rollback(), Y.current &&
|
|
121
|
+
if (bt.current) {
|
|
122
|
+
await r.rollback(), Y.current && P({
|
|
118
123
|
kind: "busy",
|
|
119
124
|
failures: []
|
|
120
125
|
});
|
|
@@ -122,292 +127,296 @@ var Ce = ({ children: e }) => e(l()), h = ({ writeAccessDenied: l = !1, onSend:
|
|
|
122
127
|
}
|
|
123
128
|
let i = a.getState();
|
|
124
129
|
if (i.activeConversationId !== n || n !== null && !i.conversations.some((e) => e.id === n)) {
|
|
125
|
-
await r.rollback(), Y.current &&
|
|
130
|
+
await r.rollback(), Y.current && P({
|
|
126
131
|
kind: "moved",
|
|
127
132
|
failures: []
|
|
128
133
|
});
|
|
129
134
|
return;
|
|
130
135
|
}
|
|
131
|
-
|
|
136
|
+
z.current = t, g(e, re(r.attachments)), r.handedOver(), k(""), nt();
|
|
132
137
|
} finally {
|
|
133
|
-
|
|
138
|
+
N.current = !1, Y.current && Ve(!1);
|
|
134
139
|
}
|
|
135
140
|
}, [
|
|
136
141
|
J,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
142
|
+
yt,
|
|
143
|
+
at,
|
|
144
|
+
g,
|
|
145
|
+
O,
|
|
141
146
|
q,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
]),
|
|
146
|
-
|
|
147
|
-
}, [
|
|
148
|
-
|
|
149
|
-
}, []),
|
|
150
|
-
if (
|
|
151
|
-
let e =
|
|
152
|
-
e !== null && (
|
|
153
|
-
}, [
|
|
147
|
+
nt,
|
|
148
|
+
W,
|
|
149
|
+
E
|
|
150
|
+
]), xt = s(() => {
|
|
151
|
+
ot(), D.current?.focus();
|
|
152
|
+
}, [ot]), Z = s(() => {
|
|
153
|
+
bt.current ? Ke.current = !0 : D.current?.focus();
|
|
154
|
+
}, []), St = s(() => {
|
|
155
|
+
if (Je.current) return;
|
|
156
|
+
let e = b?.() ?? null;
|
|
157
|
+
e !== null && (Je.current = !0, L(e)), Z();
|
|
158
|
+
}, [b, Z]);
|
|
154
159
|
c(() => {
|
|
155
|
-
!
|
|
156
|
-
}, [
|
|
157
|
-
let
|
|
160
|
+
!T && Ke.current && (Ke.current = !1, D.current?.focus());
|
|
161
|
+
}, [T]);
|
|
162
|
+
let Ct = s((e) => {
|
|
158
163
|
if (e !== null) {
|
|
159
164
|
R.current = e;
|
|
160
165
|
return;
|
|
161
166
|
}
|
|
162
167
|
let t = R.current;
|
|
163
|
-
R.current = null, t !== null && t.ownerDocument.activeElement === t && (
|
|
164
|
-
}, []), Q =
|
|
165
|
-
|
|
166
|
-
!Q &&
|
|
168
|
+
R.current = null, t !== null && t.ownerDocument.activeElement === t && (qe.current = !0);
|
|
169
|
+
}, []), Q = E && y && b !== void 0;
|
|
170
|
+
u(() => {
|
|
171
|
+
!Q && qe.current && (qe.current = !1, Z());
|
|
167
172
|
}, [Q, Z]), c(() => {
|
|
168
|
-
|
|
169
|
-
}, [
|
|
173
|
+
I === null && (Je.current = !1);
|
|
174
|
+
}, [I]), u(() => {
|
|
170
175
|
if (!Q) return;
|
|
171
|
-
let e =
|
|
172
|
-
if (
|
|
176
|
+
let e = z.current;
|
|
177
|
+
if (z.current = !1, !e) return;
|
|
173
178
|
let t = R.current;
|
|
174
179
|
if (t === null) return;
|
|
175
180
|
let n = t.ownerDocument, r = n.activeElement;
|
|
176
|
-
(r === null || r === n.body || r ===
|
|
181
|
+
(r === null || r === n.body || r === D.current) && t.focus({ preventScroll: !0 });
|
|
177
182
|
}, [Q]);
|
|
178
|
-
let
|
|
179
|
-
|
|
183
|
+
let wt = s((e) => {
|
|
184
|
+
k(e), F(null);
|
|
180
185
|
}, []);
|
|
181
186
|
c(() => {
|
|
182
|
-
|
|
183
|
-
}, [
|
|
184
|
-
let
|
|
185
|
-
if (t.kind === "busy") return
|
|
186
|
-
if (t.kind === "moved") return
|
|
187
|
+
P(null);
|
|
188
|
+
}, [V.length]);
|
|
189
|
+
let Tt = (t) => {
|
|
190
|
+
if (t.kind === "busy") return C("attachments.saveBusy", "The assistant started another reply, so nothing was sent. Your message and files are still here.");
|
|
191
|
+
if (t.kind === "moved") return C("attachments.saveMoved", "You switched conversations while the files were being saved, so nothing was sent. Your message and files are still here.");
|
|
187
192
|
let { failures: n } = t;
|
|
188
|
-
if (n.some((e) => e.code ===
|
|
189
|
-
if (n.some((e) => e.code ===
|
|
190
|
-
let r = n[0], i =
|
|
191
|
-
return `${n.length <= 1 ?
|
|
192
|
-
},
|
|
193
|
+
if (n.some((e) => e.code === ie.editorAccessRequired)) return e(C, w);
|
|
194
|
+
if (n.some((e) => e.code === ie.quotaExceeded || e.code === ie.quotaNotProvisioned)) return `${C("attachments.quotaFull", "File storage is full or not set up for this workspace, so the attachments couldn't be saved. Nothing was sent.")} ${C("attachments.retrySend", "Press Send to try again, or remove the file.")}`;
|
|
195
|
+
let r = n[0], i = V.find((e) => e.id === r?.id)?.filename ?? "";
|
|
196
|
+
return `${n.length <= 1 ? C("attachments.saveFailedOne", "{{name}} couldn't be saved, so nothing was sent.", { name: i }) : C("attachments.saveFailedMany", "{{count}} attachments couldn't be saved, so nothing was sent.", { count: n.length })} ${C("attachments.retrySend", "Press Send to try again, or remove the file.")}`;
|
|
197
|
+
}, Et = s((e) => {
|
|
193
198
|
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), X());
|
|
194
|
-
}, [X]), Et = s((e) => {
|
|
195
|
-
e.key === "Escape" ? he(e) && e.stopPropagation() : me(e) && (e.preventDefault(), P(null), X());
|
|
196
199
|
}, [X]), Dt = s((e) => {
|
|
200
|
+
e.key === "Escape" ? he(e) && e.stopPropagation() : me(e) && (e.preventDefault(), F(null), X());
|
|
201
|
+
}, [X]), Ot = s((e) => {
|
|
197
202
|
let t = Array.from(e.clipboardData?.files ?? []);
|
|
198
|
-
t.length !== 0 && (e.preventDefault(),
|
|
199
|
-
}, [
|
|
200
|
-
Array.from(e.dataTransfer?.types ?? []).includes("Files") && (
|
|
201
|
-
}, []),
|
|
202
|
-
|
|
203
|
-
}, []), At = s((e) => {
|
|
204
|
-
Array.from(e.dataTransfer?.types ?? []).includes("Files") && e.preventDefault();
|
|
203
|
+
t.length !== 0 && (e.preventDefault(), H(t));
|
|
204
|
+
}, [H]), kt = s((e) => {
|
|
205
|
+
Array.from(e.dataTransfer?.types ?? []).includes("Files") && (B.current += 1, j(!0));
|
|
206
|
+
}, []), At = s(() => {
|
|
207
|
+
B.current = Math.max(0, B.current - 1), B.current === 0 && j(!1);
|
|
205
208
|
}, []), jt = s((e) => {
|
|
206
|
-
|
|
207
|
-
}, [
|
|
209
|
+
Array.from(e.dataTransfer?.types ?? []).includes("Files") && e.preventDefault();
|
|
210
|
+
}, []), Mt = s((e) => {
|
|
211
|
+
e.preventDefault(), B.current = 0, j(!1), H(e.dataTransfer?.files ?? null);
|
|
212
|
+
}, [H]), Nt = (e) => {
|
|
208
213
|
switch (e) {
|
|
209
|
-
case "too-many": return
|
|
210
|
-
case "too-large": return
|
|
211
|
-
case "empty": return
|
|
212
|
-
case "unreadable": return
|
|
213
|
-
case "unsupported-image": return
|
|
214
|
-
case "too-large-to-save": return
|
|
214
|
+
case "too-many": return C("attachments.tooMany", "You can attach up to {{max}} files per message.", { max: 5 });
|
|
215
|
+
case "too-large": return C("attachments.tooLarge", "That file is larger than 10 MB.");
|
|
216
|
+
case "empty": return C("attachments.empty", "That file is empty.");
|
|
217
|
+
case "unreadable": return C("attachments.unreadable", "That file could not be read.");
|
|
218
|
+
case "unsupported-image": return C("attachments.unsupportedImage", "This device can't read that image format, so it can't be resized to send. Save it as JPEG and try again.");
|
|
219
|
+
case "too-large-to-save": return C("attachments.tooLargeToSave", "That file is over 5 MB, so it can't be saved to Files, and no text could be read from it.");
|
|
215
220
|
}
|
|
216
221
|
}, $ = (() => {
|
|
217
|
-
switch (
|
|
218
|
-
case "not-allowed": return
|
|
219
|
-
case "audio-capture": return
|
|
220
|
-
case "network": return
|
|
221
|
-
case "language-not-supported": return
|
|
222
|
-
case "unknown": return
|
|
222
|
+
switch (W.error) {
|
|
223
|
+
case "not-allowed": return C("voice.denied", "Microphone access is blocked. Allow it in your browser settings to dictate.");
|
|
224
|
+
case "audio-capture": return C("voice.noMic", "No microphone was found.");
|
|
225
|
+
case "network": return C("voice.network", "Speech recognition is offline right now.");
|
|
226
|
+
case "language-not-supported": return C("voice.languageNotSupported", "This browser cannot recognise spoken {{language}}. Try a different browser, or type instead.", { language: i(W.language, w) });
|
|
227
|
+
case "unknown": return C("voice.failed", "Dictation stopped unexpectedly.");
|
|
223
228
|
default: return null;
|
|
224
229
|
}
|
|
225
|
-
})(),
|
|
226
|
-
onDismiss:
|
|
227
|
-
children: /* @__PURE__ */
|
|
230
|
+
})(), Pt = (e, n) => M ? /* @__PURE__ */ m(t, {
|
|
231
|
+
onDismiss: xt,
|
|
232
|
+
children: /* @__PURE__ */ h("p", {
|
|
228
233
|
className: "flex items-center justify-center gap-2 text-text-muted",
|
|
229
234
|
"data-testid": "assistant-commit-status",
|
|
230
235
|
children: [
|
|
231
|
-
/* @__PURE__ */ p
|
|
236
|
+
/* @__PURE__ */ m(p, {
|
|
232
237
|
className: "size-3 motion-safe:animate-spin",
|
|
233
238
|
"aria-hidden": "true"
|
|
234
239
|
}),
|
|
235
|
-
/* @__PURE__ */
|
|
236
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ m("span", { children: C("attachments.saving", "Saving your attachments…") }),
|
|
241
|
+
/* @__PURE__ */ m("button", {
|
|
237
242
|
type: "button",
|
|
238
|
-
onClick:
|
|
243
|
+
onClick: xt,
|
|
239
244
|
className: "rounded text-text-primary underline underline-offset-2 hover:text-action-primary-bg focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong",
|
|
240
245
|
"data-testid": "assistant-commit-cancel",
|
|
241
|
-
children:
|
|
246
|
+
children: C("attachments.cancelSaving", "Cancel")
|
|
242
247
|
})
|
|
243
248
|
]
|
|
244
249
|
})
|
|
245
|
-
}) :
|
|
250
|
+
}) : He ? /* @__PURE__ */ m("p", {
|
|
246
251
|
className: "text-status-error-text",
|
|
247
252
|
role: "alert",
|
|
248
253
|
"data-testid": "assistant-commit-failed",
|
|
249
|
-
children:
|
|
250
|
-
}) :
|
|
254
|
+
children: Tt(He)
|
|
255
|
+
}) : W.isStarting && !W.isListening ? /* @__PURE__ */ m("p", {
|
|
251
256
|
className: "text-text-muted",
|
|
252
257
|
"data-testid": "assistant-voice-starting",
|
|
253
|
-
children:
|
|
254
|
-
}) :
|
|
258
|
+
children: C("voice.starting", "Starting the microphone…")
|
|
259
|
+
}) : W.isListening ? /* @__PURE__ */ h("p", {
|
|
255
260
|
className: "text-status-error-text",
|
|
256
261
|
"data-testid": "assistant-voice-status",
|
|
257
|
-
children: [/* @__PURE__ */
|
|
258
|
-
}) : $ ? /* @__PURE__ */
|
|
262
|
+
children: [/* @__PURE__ */ m(le, {}), W.interim || C("voice.listening", "Listening… speak now, tap the square to stop")]
|
|
263
|
+
}) : $ ? /* @__PURE__ */ m("p", {
|
|
259
264
|
className: "text-status-error-text",
|
|
260
265
|
"data-testid": "assistant-voice-error",
|
|
261
266
|
children: $
|
|
262
|
-
}) :
|
|
267
|
+
}) : $e ? /* @__PURE__ */ m("button", {
|
|
263
268
|
type: "button",
|
|
264
|
-
onClick:
|
|
269
|
+
onClick: rt,
|
|
265
270
|
className: "text-status-error-text underline-offset-2 hover:underline",
|
|
266
271
|
"data-testid": "assistant-attachment-rejection",
|
|
267
|
-
children:
|
|
268
|
-
}) :
|
|
272
|
+
children: Nt($e)
|
|
273
|
+
}) : Qe === "failed" ? /* @__PURE__ */ m("p", {
|
|
269
274
|
className: "text-status-error-text",
|
|
270
275
|
"data-testid": "assistant-attachment-blocked",
|
|
271
|
-
children:
|
|
272
|
-
}) : n ? /* @__PURE__ */
|
|
276
|
+
children: vt.length === 1 ? C("attachments.blockedOne", "{{name}} didn't upload. Retry or remove it before sending.", { name: vt[0].filename }) : C("attachments.blockedMany", "{{count}} attachments didn't upload. Retry or remove them before sending.", { count: vt.length })
|
|
277
|
+
}) : n ? /* @__PURE__ */ m("p", {
|
|
273
278
|
className: "text-text-muted",
|
|
274
279
|
"data-testid": "assistant-stopping-status",
|
|
275
|
-
children:
|
|
276
|
-
}) : e ? /* @__PURE__ */
|
|
280
|
+
children: C("composer.stopping", "Stopping the reply…")
|
|
281
|
+
}) : e ? /* @__PURE__ */ m("p", {
|
|
277
282
|
className: "text-text-muted",
|
|
278
283
|
"data-testid": "assistant-stop-status",
|
|
279
|
-
children:
|
|
280
|
-
}) : /* @__PURE__ */
|
|
284
|
+
children: C("composer.stopped", "Reply stopped.")
|
|
285
|
+
}) : /* @__PURE__ */ m("p", {
|
|
281
286
|
className: "text-text-muted",
|
|
282
|
-
children:
|
|
287
|
+
children: C("composer.hint", "Enter to send · Shift+Enter for newline · drag or paste files to attach")
|
|
283
288
|
});
|
|
284
|
-
if (
|
|
285
|
-
let e = v !== void 0 &&
|
|
286
|
-
return /* @__PURE__ */
|
|
287
|
-
ref:
|
|
289
|
+
if (E) {
|
|
290
|
+
let e = v !== void 0 && K.length === 0 && V.length === 0 && !W.isActive, t = C("composer.hint", "Enter to send · Shift+Enter for newline · drag or paste files to attach"), n = !!(M || He || W.isStarting || W.isListening || $ || $e || Qe === "failed" || Ue !== null || I !== null), r = "focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--color-bg-elevated)]";
|
|
291
|
+
return /* @__PURE__ */ m(Se, { children: (i) => /* @__PURE__ */ h("div", {
|
|
292
|
+
ref: Ye,
|
|
288
293
|
className: "flex-shrink-0 px-3 pt-1.5",
|
|
289
294
|
children: [
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
voiceLive:
|
|
293
|
-
children:
|
|
295
|
+
Le,
|
|
296
|
+
Re ? /* @__PURE__ */ m(pe, {
|
|
297
|
+
voiceLive: S,
|
|
298
|
+
children: Re
|
|
294
299
|
}) : null,
|
|
295
|
-
/* @__PURE__ */
|
|
300
|
+
/* @__PURE__ */ h("div", {
|
|
296
301
|
className: n || l ? "mb-1.5 px-1 text-center text-xs" : "",
|
|
297
302
|
"aria-live": "polite",
|
|
298
303
|
"data-testid": "assistant-composer-status",
|
|
299
|
-
children: [l ? /* @__PURE__ */
|
|
304
|
+
children: [l ? /* @__PURE__ */ m("p", {
|
|
300
305
|
className: "text-status-warning",
|
|
301
306
|
"data-testid": "assistant-write-access-warning",
|
|
302
|
-
children:
|
|
303
|
-
}) : null, n ?
|
|
307
|
+
children: C("composer.writeAccessDenied", "Changes may not save — your role in this workspace does not currently allow edits. You can still plan and review an action.")
|
|
308
|
+
}) : null, n ? Pt(Ue !== null, I !== null) : null]
|
|
304
309
|
}),
|
|
305
|
-
/* @__PURE__ */
|
|
310
|
+
/* @__PURE__ */ m("p", {
|
|
306
311
|
id: i,
|
|
307
312
|
hidden: !0,
|
|
308
313
|
"data-testid": "assistant-composer-hint",
|
|
309
314
|
children: t
|
|
310
315
|
}),
|
|
311
|
-
/* @__PURE__ */
|
|
312
|
-
onDragEnter:
|
|
313
|
-
onDragLeave:
|
|
314
|
-
onDragOver:
|
|
315
|
-
onDrop:
|
|
316
|
-
className: `flex flex-col rounded-3xl border transition-colors focus-within:border-[var(--color-focus-ring)] focus-within:ring-1 focus-within:ring-[var(--color-focus-ring)] ${
|
|
316
|
+
/* @__PURE__ */ h("div", {
|
|
317
|
+
onDragEnter: kt,
|
|
318
|
+
onDragLeave: At,
|
|
319
|
+
onDragOver: jt,
|
|
320
|
+
onDrop: Mt,
|
|
321
|
+
className: `flex flex-col rounded-3xl border transition-colors focus-within:border-[var(--color-focus-ring)] focus-within:ring-1 focus-within:ring-[var(--color-focus-ring)] ${ze ? "bg-bg-surface" : "bg-bg-elevated"} ${A ? "border-dashed border-[var(--color-focus-ring)]" : "border-[var(--color-text-muted)]"}`,
|
|
317
322
|
"data-testid": "assistant-composer",
|
|
318
323
|
"data-presentation": "compact",
|
|
319
324
|
children: [
|
|
320
|
-
/* @__PURE__ */
|
|
325
|
+
/* @__PURE__ */ m("div", {
|
|
321
326
|
className: "px-3 pt-3 empty:hidden",
|
|
322
|
-
children: /* @__PURE__ */
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
327
|
+
children: /* @__PURE__ */ h(ye, { children: [/* @__PURE__ */ m(se, {
|
|
328
|
+
disabled: M,
|
|
329
|
+
showSuggestions: K.length === 0,
|
|
330
|
+
onSuggest: _t
|
|
331
|
+
}), /* @__PURE__ */ m(oe, {
|
|
332
|
+
attachments: V,
|
|
333
|
+
onRemove: et,
|
|
334
|
+
onRetry: tt,
|
|
335
|
+
disabled: T || M,
|
|
336
|
+
preparingCount: Ze
|
|
328
337
|
})] })
|
|
329
338
|
}),
|
|
330
|
-
/* @__PURE__ */
|
|
331
|
-
ref:
|
|
332
|
-
value:
|
|
333
|
-
onChange: (e) =>
|
|
334
|
-
onKeyDown:
|
|
335
|
-
onPaste:
|
|
336
|
-
disabled:
|
|
337
|
-
readOnly:
|
|
338
|
-
"aria-busy":
|
|
339
|
-
placeholder:
|
|
339
|
+
/* @__PURE__ */ m("textarea", {
|
|
340
|
+
ref: Be,
|
|
341
|
+
value: O,
|
|
342
|
+
onChange: (e) => wt(e.target.value),
|
|
343
|
+
onKeyDown: Dt,
|
|
344
|
+
onPaste: Ot,
|
|
345
|
+
disabled: T,
|
|
346
|
+
readOnly: M,
|
|
347
|
+
"aria-busy": M || void 0,
|
|
348
|
+
placeholder: A ? C("composer.dropHere", "Drop files to attach") : ht,
|
|
340
349
|
rows: 1,
|
|
341
350
|
className: "min-h-10 w-full resize-none bg-transparent px-4 pb-1 pt-3 text-base leading-6 text-text-primary placeholder:text-text-muted focus:outline-none disabled:opacity-50",
|
|
342
351
|
"aria-describedby": i,
|
|
343
352
|
title: t,
|
|
344
|
-
"aria-label":
|
|
353
|
+
"aria-label": C("chatInput.ariaLabel", "Message input"),
|
|
345
354
|
"data-testid": "assistant-input"
|
|
346
355
|
}),
|
|
347
|
-
/* @__PURE__ */
|
|
356
|
+
/* @__PURE__ */ h("div", {
|
|
348
357
|
className: "flex flex-nowrap items-center gap-1 px-1.5 pb-1.5 pt-1",
|
|
349
358
|
"data-testid": "assistant-composer-controls",
|
|
350
359
|
children: [
|
|
351
|
-
/* @__PURE__ */
|
|
352
|
-
onFiles:
|
|
353
|
-
canAddMore:
|
|
354
|
-
disabled:
|
|
360
|
+
/* @__PURE__ */ m(ae, {
|
|
361
|
+
onFiles: H,
|
|
362
|
+
canAddMore: it,
|
|
363
|
+
disabled: T || M,
|
|
355
364
|
compact: !0,
|
|
356
365
|
capMenuHeight: !0
|
|
357
366
|
}),
|
|
358
|
-
/* @__PURE__ */
|
|
367
|
+
/* @__PURE__ */ m(fe, {
|
|
359
368
|
chip: !0,
|
|
360
|
-
readOnly:
|
|
369
|
+
readOnly: ze,
|
|
361
370
|
mode: Ee,
|
|
362
371
|
availableModes: _,
|
|
363
372
|
onModeChange: Oe,
|
|
364
373
|
auto: ke,
|
|
365
|
-
disabled:
|
|
366
|
-
disabledReason:
|
|
374
|
+
disabled: T || M,
|
|
375
|
+
disabledReason: I === null ? y ? "replying" : Ie ?? "busy" : "busy"
|
|
367
376
|
}),
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
-
|
|
377
|
+
/* @__PURE__ */ m("div", { className: "min-w-0 flex-1" }),
|
|
378
|
+
W.isSupported && !S && /* @__PURE__ */ m(ce, {
|
|
370
379
|
compact: !0,
|
|
371
|
-
isListening:
|
|
372
|
-
isStarting:
|
|
373
|
-
onToggle:
|
|
374
|
-
disabled:
|
|
380
|
+
isListening: W.isListening,
|
|
381
|
+
isStarting: W.isStarting,
|
|
382
|
+
onToggle: W.toggle,
|
|
383
|
+
disabled: T || M
|
|
375
384
|
}),
|
|
376
|
-
Q ? /* @__PURE__ */
|
|
377
|
-
ref:
|
|
385
|
+
Q ? /* @__PURE__ */ m("button", {
|
|
386
|
+
ref: Ct,
|
|
378
387
|
type: "button",
|
|
379
|
-
onClick:
|
|
380
|
-
className: `flex size-11 sm:size-10 flex-shrink-0 items-center justify-center rounded-full bg-action-primary-bg text-action-primary-text transition-colors hover:bg-action-primary-bg-hover ${r} ${
|
|
381
|
-
"aria-label":
|
|
382
|
-
title:
|
|
383
|
-
"aria-disabled":
|
|
384
|
-
"aria-busy":
|
|
388
|
+
onClick: St,
|
|
389
|
+
className: `flex size-11 sm:size-10 flex-shrink-0 items-center justify-center rounded-full bg-action-primary-bg text-action-primary-text transition-colors hover:bg-action-primary-bg-hover ${r} ${I === null ? "" : "cursor-default opacity-60"}`,
|
|
390
|
+
"aria-label": I === null ? C("composer.stop", "Stop the reply") : C("composer.stopping", "Stopping the reply…"),
|
|
391
|
+
title: I === null ? C("composer.stop", "Stop the reply") : C("composer.stopping", "Stopping the reply…"),
|
|
392
|
+
"aria-disabled": I === null ? void 0 : "true",
|
|
393
|
+
"aria-busy": I === null ? void 0 : "true",
|
|
385
394
|
"data-testid": "assistant-stop",
|
|
386
|
-
children:
|
|
395
|
+
children: I === null ? /* @__PURE__ */ m(ve, {
|
|
387
396
|
className: "size-4 fill-current",
|
|
388
397
|
"aria-hidden": "true"
|
|
389
|
-
}) : /* @__PURE__ */ p
|
|
398
|
+
}) : /* @__PURE__ */ m(p, {
|
|
390
399
|
className: "size-4 motion-safe:animate-spin",
|
|
391
400
|
"aria-hidden": "true"
|
|
392
401
|
})
|
|
393
|
-
}) : e ? /* @__PURE__ */
|
|
402
|
+
}) : e ? /* @__PURE__ */ m(ue, {
|
|
394
403
|
compact: !0,
|
|
395
|
-
invisible:
|
|
404
|
+
invisible: S,
|
|
396
405
|
onStart: v,
|
|
397
|
-
disabled:
|
|
398
|
-
}) : /* @__PURE__ */
|
|
406
|
+
disabled: T || M
|
|
407
|
+
}) : /* @__PURE__ */ m("button", {
|
|
399
408
|
type: "button",
|
|
400
409
|
onClick: () => {
|
|
401
|
-
|
|
410
|
+
F(null), X();
|
|
402
411
|
},
|
|
403
412
|
disabled: !J,
|
|
404
413
|
className: `flex size-11 sm:size-10 flex-shrink-0 items-center justify-center rounded-full transition-colors ${r} ${J ? "bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg-hover" : "bg-[var(--color-bg-disabled)] text-[var(--color-text-disabled)]"}`,
|
|
405
|
-
"aria-label":
|
|
414
|
+
"aria-label": C("chatInput.send", "Send message"),
|
|
406
415
|
"data-testid": "assistant-send",
|
|
407
|
-
children:
|
|
416
|
+
children: Ce || Xe || M ? /* @__PURE__ */ m(p, {
|
|
408
417
|
className: "size-5 motion-safe:animate-spin",
|
|
409
418
|
"aria-hidden": "true"
|
|
410
|
-
}) : /* @__PURE__ */
|
|
419
|
+
}) : /* @__PURE__ */ m(_e, {
|
|
411
420
|
className: "size-5",
|
|
412
421
|
"aria-hidden": "true"
|
|
413
422
|
})
|
|
@@ -419,91 +428,95 @@ var Ce = ({ children: e }) => e(l()), h = ({ writeAccessDenied: l = !1, onSend:
|
|
|
419
428
|
]
|
|
420
429
|
}) });
|
|
421
430
|
}
|
|
422
|
-
return /* @__PURE__ */
|
|
431
|
+
return /* @__PURE__ */ h("div", {
|
|
423
432
|
className: "flex-shrink-0 px-3 pb-3 pt-1.5",
|
|
424
433
|
children: [
|
|
425
|
-
/* @__PURE__ */
|
|
426
|
-
onDragEnter:
|
|
427
|
-
onDragLeave:
|
|
428
|
-
onDragOver:
|
|
429
|
-
onDrop:
|
|
430
|
-
className: `rounded-2xl border p-2 shadow-sm transition-colors focus-within:border-action-primary-bg focus-within:ring-2 focus-within:ring-action-primary-bg/15 ${
|
|
434
|
+
/* @__PURE__ */ h("div", {
|
|
435
|
+
onDragEnter: kt,
|
|
436
|
+
onDragLeave: At,
|
|
437
|
+
onDragOver: jt,
|
|
438
|
+
onDrop: Mt,
|
|
439
|
+
className: `rounded-2xl border p-2 shadow-sm transition-colors focus-within:border-action-primary-bg focus-within:ring-2 focus-within:ring-action-primary-bg/15 ${A ? "border-action-primary-bg border-dashed bg-action-primary-bg/5" : "border-border-default bg-bg-sunken"}`,
|
|
431
440
|
"data-testid": "assistant-composer",
|
|
432
441
|
children: [
|
|
433
|
-
/* @__PURE__ */
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
442
|
+
/* @__PURE__ */ h(ye, { children: [/* @__PURE__ */ m(se, {
|
|
443
|
+
disabled: M,
|
|
444
|
+
showSuggestions: K.length === 0,
|
|
445
|
+
onSuggest: _t
|
|
446
|
+
}), /* @__PURE__ */ m(oe, {
|
|
447
|
+
attachments: V,
|
|
448
|
+
onRemove: et,
|
|
449
|
+
onRetry: tt,
|
|
450
|
+
disabled: T || M,
|
|
451
|
+
preparingCount: Ze
|
|
439
452
|
})] }),
|
|
440
|
-
/* @__PURE__ */
|
|
453
|
+
/* @__PURE__ */ h("div", {
|
|
441
454
|
className: "flex items-end gap-2",
|
|
442
455
|
children: [
|
|
443
|
-
/* @__PURE__ */
|
|
444
|
-
onFiles:
|
|
445
|
-
canAddMore:
|
|
446
|
-
disabled:
|
|
456
|
+
/* @__PURE__ */ m(ae, {
|
|
457
|
+
onFiles: H,
|
|
458
|
+
canAddMore: it,
|
|
459
|
+
disabled: T || M,
|
|
447
460
|
showLabel: !0
|
|
448
461
|
}),
|
|
449
|
-
/* @__PURE__ */
|
|
450
|
-
ref:
|
|
451
|
-
value:
|
|
452
|
-
onChange: (e) =>
|
|
453
|
-
onKeyDown:
|
|
454
|
-
onPaste:
|
|
455
|
-
disabled:
|
|
456
|
-
readOnly:
|
|
457
|
-
"aria-busy":
|
|
458
|
-
placeholder:
|
|
462
|
+
/* @__PURE__ */ m("textarea", {
|
|
463
|
+
ref: D,
|
|
464
|
+
value: O,
|
|
465
|
+
onChange: (e) => k(e.target.value),
|
|
466
|
+
onKeyDown: Et,
|
|
467
|
+
onPaste: Ot,
|
|
468
|
+
disabled: T,
|
|
469
|
+
readOnly: M,
|
|
470
|
+
"aria-busy": M || void 0,
|
|
471
|
+
placeholder: A ? C("composer.dropHere", "Drop files to attach") : ht,
|
|
459
472
|
rows: 1,
|
|
460
473
|
className: "min-h-[36px] flex-1 resize-none self-center bg-transparent px-1 py-2 text-[15px] leading-relaxed text-text-primary placeholder:text-text-muted focus:outline-none disabled:opacity-50",
|
|
461
|
-
"aria-label":
|
|
474
|
+
"aria-label": C("chatInput.ariaLabel", "Message input"),
|
|
462
475
|
"data-testid": "assistant-input"
|
|
463
476
|
}),
|
|
464
|
-
|
|
465
|
-
isListening:
|
|
466
|
-
isStarting:
|
|
467
|
-
onToggle:
|
|
468
|
-
disabled:
|
|
477
|
+
W.isSupported && /* @__PURE__ */ m(ce, {
|
|
478
|
+
isListening: W.isListening,
|
|
479
|
+
isStarting: W.isStarting,
|
|
480
|
+
onToggle: W.toggle,
|
|
481
|
+
disabled: T || M
|
|
469
482
|
}),
|
|
470
|
-
v &&
|
|
483
|
+
v && K.length === 0 && V.length === 0 && !W.isActive ? /* @__PURE__ */ m(ue, {
|
|
471
484
|
onStart: v,
|
|
472
|
-
disabled:
|
|
473
|
-
}) : /* @__PURE__ */
|
|
485
|
+
disabled: T || M
|
|
486
|
+
}) : /* @__PURE__ */ m("button", {
|
|
474
487
|
type: "button",
|
|
475
488
|
onClick: () => void X(),
|
|
476
489
|
disabled: !J,
|
|
477
490
|
className: `flex size-9 flex-shrink-0 items-center justify-center rounded-full shadow-sm transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${J ? "bg-action-primary-bg text-action-primary-text hover:scale-105 hover:bg-action-primary-bg-hover" : "bg-bg-elevated text-text-muted"}`,
|
|
478
|
-
"aria-label":
|
|
491
|
+
"aria-label": C("chatInput.send", "Send message"),
|
|
479
492
|
"data-testid": "assistant-send",
|
|
480
|
-
children:
|
|
493
|
+
children: Ce || Xe || M ? /* @__PURE__ */ m(p, { className: "size-4 motion-safe:animate-spin" }) : /* @__PURE__ */ m(_e, { className: "size-4" })
|
|
481
494
|
})
|
|
482
495
|
]
|
|
483
496
|
}),
|
|
484
|
-
(_.length > 1 || _.some((e) => e.writeCapable)) && /* @__PURE__ */
|
|
497
|
+
(_.length > 1 || _.some((e) => e.writeCapable)) && /* @__PURE__ */ m("div", {
|
|
485
498
|
className: "mt-2 px-0.5",
|
|
486
|
-
children: /* @__PURE__ */
|
|
499
|
+
children: /* @__PURE__ */ m(de, {
|
|
487
500
|
mode: Ee,
|
|
488
501
|
availableModes: _,
|
|
489
502
|
onModeChange: Oe,
|
|
490
|
-
disabled:
|
|
503
|
+
disabled: T || M,
|
|
491
504
|
auto: ke
|
|
492
505
|
})
|
|
493
506
|
})
|
|
494
507
|
]
|
|
495
508
|
}),
|
|
496
|
-
l ? /* @__PURE__ */
|
|
509
|
+
l ? /* @__PURE__ */ m("p", {
|
|
497
510
|
className: "mt-1.5 px-1 text-center text-[11px] text-status-warning",
|
|
498
511
|
"data-testid": "assistant-write-access-warning",
|
|
499
|
-
children:
|
|
512
|
+
children: C("composer.writeAccessDenied", "Changes may not save — your role in this workspace does not currently allow edits. You can still plan and review an action.")
|
|
500
513
|
}) : null,
|
|
501
|
-
/* @__PURE__ */
|
|
514
|
+
/* @__PURE__ */ m("div", {
|
|
502
515
|
className: "mt-1.5 px-1 text-center text-[11px]",
|
|
503
516
|
"aria-live": "polite",
|
|
504
|
-
children:
|
|
517
|
+
children: Pt(!1, !1)
|
|
505
518
|
})
|
|
506
519
|
]
|
|
507
520
|
});
|
|
508
521
|
};
|
|
509
|
-
export {
|
|
522
|
+
export { g as AssistantComposer };
|