@burdenoff/fe-libs 2026.924.2 → 2026.924.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/adminModeSendGate.d.ts.map +1 -1
- package/dist/shared/assistant/adminModeSendGate.js +23 -20
- package/dist/shared/assistant/autoRouting.d.ts +197 -0
- package/dist/shared/assistant/autoRouting.d.ts.map +1 -0
- package/dist/shared/assistant/autoRouting.js +854 -0
- package/dist/shared/assistant/conversation.d.ts +13 -0
- package/dist/shared/assistant/conversation.d.ts.map +1 -1
- package/dist/shared/assistant/i18nManifest.d.ts +2 -0
- package/dist/shared/assistant/i18nManifest.d.ts.map +1 -1
- package/dist/shared/assistant/i18nManifest.js +23 -19
- package/dist/shared/assistant/index.d.ts +3 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/modeCapabilities.d.ts +1 -1
- package/dist/shared/assistant/modeCapabilities.d.ts.map +1 -1
- package/dist/shared/assistant/modeCapabilities.js +29 -28
- package/dist/shared/assistant/permissionError.d.ts.map +1 -1
- package/dist/shared/assistant/permissionError.js +11 -10
- package/dist/shared/assistant/store.d.ts +32 -2
- package/dist/shared/assistant/store.d.ts.map +1 -1
- package/dist/shared/assistant/store.js +69 -29
- package/dist/shared/assistant/turnOutcome.d.ts +58 -0
- package/dist/shared/assistant/turnOutcome.d.ts.map +1 -0
- package/dist/shared/assistant/turnOutcome.js +79 -0
- package/dist/shared/assistant/turnOutcomeCopy.d.ts +62 -0
- package/dist/shared/assistant/turnOutcomeCopy.d.ts.map +1 -0
- package/dist/shared/assistant/turnOutcomeCopy.js +49 -0
- package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantChatArea.js +475 -399
- package/dist/shared/assistant/ui/AssistantEmptyState.d.ts +17 -1
- package/dist/shared/assistant/ui/AssistantEmptyState.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantEmptyState.js +14 -9
- package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts +3 -0
- package/dist/shared/assistant/ui/composer/AssistantComposer.d.ts.map +1 -1
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +110 -109
- package/dist/shared/assistant/ui/composer/AssistantModeSelector.d.ts +20 -0
- package/dist/shared/assistant/ui/composer/AssistantModeSelector.d.ts.map +1 -1
- package/dist/shared/assistant/ui/composer/AssistantModeSelector.js +89 -45
- package/dist/shared/assistant/writeModeConsent.d.ts +15 -2
- package/dist/shared/assistant/writeModeConsent.d.ts.map +1 -1
- package/dist/shared/assistant/writeModeConsent.js +24 -19
- package/dist/shared-assistant.js +116 -113
- package/package.json +1 -1
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { AssistantMode } from '../types';
|
|
3
|
+
import { AssistantIntent, AutoSuggestion } from '../autoRouting';
|
|
3
4
|
interface Props {
|
|
4
5
|
mode: AssistantMode;
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* `intent` is set only for an Auto chip: which mode's list it came from, so
|
|
8
|
+
* the send is routed by that rather than by reading its (translated) text.
|
|
9
|
+
*/
|
|
10
|
+
onSuggestionClick: (suggestion: string, intent?: AssistantIntent) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Chips to show instead of the active mode's — Auto's mix of the read and the
|
|
13
|
+
* write mode's suggestions (BOFF-7800).
|
|
14
|
+
*/
|
|
15
|
+
suggestions?: readonly AutoSuggestion[];
|
|
16
|
+
/**
|
|
17
|
+
* Say what Auto does. The pill's own hint is a `title` and a screen-reader
|
|
18
|
+
* description; a sighted touch user reaches neither, and an empty Auto
|
|
19
|
+
* conversation is exactly when they need it.
|
|
20
|
+
*/
|
|
21
|
+
explainsAuto?: boolean;
|
|
6
22
|
}
|
|
7
23
|
/**
|
|
8
24
|
* AssistantEmptyState — the v2 zero-message surface (per the "panel-welcome"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantEmptyState.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantEmptyState.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"AssistantEmptyState.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantEmptyState.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAItE,UAAU,KAAK;IACb,IAAI,EAAE,aAAa,CAAC;IACpB;;;OAGG;IACH,iBAAiB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,KAAK,IAAI,CAAC;IAC1E;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IACxC;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,KAAK,CA2EzC,CAAC"}
|
|
@@ -3,8 +3,8 @@ import { useAssistantTr as r } from "../i18n.js";
|
|
|
3
3
|
import { Sparkles as i } from "lucide-react";
|
|
4
4
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
5
5
|
//#region src/shared/assistant/ui/AssistantEmptyState.tsx
|
|
6
|
-
var s = ({ mode: s, onSuggestionClick: c }) => {
|
|
7
|
-
let
|
|
6
|
+
var s = ({ mode: s, onSuggestionClick: c, suggestions: l, explainsAuto: u = !1 }) => {
|
|
7
|
+
let d = r(), { modes: f } = n(), p = e(f, s), m = t(), h = l ?? (p?.suggestions.slice(0, 4) ?? []).map((e) => ({ text: e }));
|
|
8
8
|
return /* @__PURE__ */ o("div", {
|
|
9
9
|
className: "flex flex-1 flex-col items-center justify-center overflow-y-auto px-6 py-8 text-center",
|
|
10
10
|
children: [
|
|
@@ -14,21 +14,26 @@ var s = ({ mode: s, onSuggestionClick: c }) => {
|
|
|
14
14
|
}),
|
|
15
15
|
/* @__PURE__ */ a("h2", {
|
|
16
16
|
className: "mt-5 text-2xl font-semibold leading-tight tracking-tight text-text-primary",
|
|
17
|
-
children:
|
|
17
|
+
children: d("empty.title", "How can I help?")
|
|
18
18
|
}),
|
|
19
19
|
/* @__PURE__ */ a("p", {
|
|
20
20
|
className: "mt-2 max-w-[16rem] text-[13px] leading-relaxed text-text-muted",
|
|
21
|
-
children:
|
|
21
|
+
children: m ? d("empty.subtitle", "You're viewing {{page}}. Ask about it, or pick a suggestion below.", { page: m }) : d("empty.subtitleNoPage", "Ask me anything, or pick a suggestion below.")
|
|
22
22
|
}),
|
|
23
|
+
u ? /* @__PURE__ */ a("p", {
|
|
24
|
+
className: "mt-2 max-w-[18rem] text-[12px] leading-relaxed text-text-muted",
|
|
25
|
+
"data-testid": "assistant-auto-explainer",
|
|
26
|
+
children: d("modeSelector.autoHint", "Answers your questions, and proposes changes for you to approve")
|
|
27
|
+
}) : null,
|
|
23
28
|
/* @__PURE__ */ a("div", {
|
|
24
29
|
className: "mt-6 flex flex-wrap items-center justify-center gap-2",
|
|
25
|
-
children:
|
|
30
|
+
children: h.map((e) => /* @__PURE__ */ a("button", {
|
|
26
31
|
type: "button",
|
|
27
|
-
onClick: () => c(e),
|
|
28
|
-
className: "rounded-full border border-border-subtle bg-bg-surface px-3.5 py-2 text-[13px] leading-tight text-text-primary shadow-sm transition-
|
|
32
|
+
onClick: () => c(e.text, e.intent),
|
|
33
|
+
className: "rounded-full border border-border-subtle bg-bg-surface px-3.5 py-2 text-[13px] leading-tight text-text-primary shadow-sm transition-[color,background-color,border-color,box-shadow] hover:border-action-primary-bg/40 hover:bg-bg-elevated hover:shadow-md",
|
|
29
34
|
"data-testid": "assistant-suggestion",
|
|
30
|
-
children: e
|
|
31
|
-
}, e))
|
|
35
|
+
children: e.text
|
|
36
|
+
}, e.text))
|
|
32
37
|
})
|
|
33
38
|
]
|
|
34
39
|
});
|
|
@@ -2,6 +2,7 @@ import { FC } from 'react';
|
|
|
2
2
|
import { AssistantModeConfig } from '../../conversation';
|
|
3
3
|
import { AssistantMode } from '../../types';
|
|
4
4
|
import { AssistantAttachment } from '../../attachments';
|
|
5
|
+
import { AssistantAutoOption } from './AssistantModeSelector';
|
|
5
6
|
interface Props {
|
|
6
7
|
/**
|
|
7
8
|
* Writes would be refused in this workspace. Advisory only — the mode stays
|
|
@@ -33,6 +34,8 @@ interface Props {
|
|
|
33
34
|
*/
|
|
34
35
|
attachmentCharsPerFile?: number;
|
|
35
36
|
onModeChange: (mode: AssistantMode) => void;
|
|
37
|
+
/** Offer Auto as the first mode pill (BOFF-7800); absent where it is not offered. */
|
|
38
|
+
auto?: AssistantAutoOption;
|
|
36
39
|
/**
|
|
37
40
|
* Opens the hands-free voice conversation. Omitted where a voice session
|
|
38
41
|
* cannot work at all (no speech input, or nothing able to speak the reply),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantComposer.d.ts","sourceRoot":"","sources":["../../../../../src/shared/assistant/ui/composer/AssistantComposer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,EAAE,EAER,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAQjD,OAAO,EAGL,KAAK,mBAAmB,EAEzB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"AssistantComposer.d.ts","sourceRoot":"","sources":["../../../../../src/shared/assistant/ui/composer/AssistantComposer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,EAAE,EAER,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAQjD,OAAO,EAGL,KAAK,mBAAmB,EAEzB,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAC;AAEjC,UAAU,KAAK;IACb;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAE,KAAK,IAAI,CAAC;IACtE,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,aAAa,CAAC;IACpB,qDAAqD;IACrD,cAAc,EAAE,mBAAmB,EAAE,CAAC;IACtC;;;;;;;;;;OAUG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,YAAY,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAC5C,qFAAqF;IACrF,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;CAClC;AAID;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,KAAK,CA+ZvC,CAAC"}
|
|
@@ -1,178 +1,179 @@
|
|
|
1
1
|
import { useI18n as e } from "../../../providers/shell/I18nProvider.js";
|
|
2
2
|
import { useVoiceInput as t } from "../../voice/useVoiceInput.js";
|
|
3
|
-
import { useAssistantTr as
|
|
4
|
-
import { languageDisplayName as
|
|
3
|
+
import { useAssistantTr as n } from "../../i18n.js";
|
|
4
|
+
import { languageDisplayName as ee } from "../../voice/speechVoices.js";
|
|
5
5
|
import { resolveAssistantLanguage as r } from "../../voice/languages.js";
|
|
6
|
-
import { getSendableAttachments as
|
|
7
|
-
import { useAssistantStore as
|
|
8
|
-
import { AssistantAttachmentButton as
|
|
9
|
-
import { AssistantAttachmentChips as
|
|
10
|
-
import { AssistantModeSelector as
|
|
11
|
-
import { AssistantVoiceButton as
|
|
12
|
-
import { AssistantVoiceSessionButton as
|
|
13
|
-
import { useAssistantAttachments as
|
|
14
|
-
import { useCallback as l, useLayoutEffect as u, useMemo as
|
|
15
|
-
import { ArrowUp as
|
|
16
|
-
import { jsx as
|
|
6
|
+
import { getSendableAttachments as te } from "../../attachments.js";
|
|
7
|
+
import { useAssistantStore as ne } from "../../store.js";
|
|
8
|
+
import { AssistantAttachmentButton as re } from "./AssistantAttachmentButton.js";
|
|
9
|
+
import { AssistantAttachmentChips as i } from "./AssistantAttachmentChips.js";
|
|
10
|
+
import { AssistantModeSelector as a } from "./AssistantModeSelector.js";
|
|
11
|
+
import { AssistantVoiceButton as o } from "./AssistantVoiceButton.js";
|
|
12
|
+
import { AssistantVoiceSessionButton as s } from "../voice/AssistantVoiceSessionButton.js";
|
|
13
|
+
import { useAssistantAttachments as c } from "../../useAssistantAttachments.js";
|
|
14
|
+
import { useCallback as l, useLayoutEffect as u, useMemo as ie, useRef as d, useState as f } from "react";
|
|
15
|
+
import { ArrowUp as ae, Loader2 as oe } from "lucide-react";
|
|
16
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
17
17
|
//#region src/shared/assistant/ui/composer/AssistantComposer.tsx
|
|
18
|
-
var
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
}, []),
|
|
22
|
-
onFinalize:
|
|
23
|
-
language:
|
|
24
|
-
}),
|
|
18
|
+
var h = 200, g = ({ writeAccessDenied: g = !1, onSend: _, disabled: v = !1, placeholder: y, mode: b, availableModes: x, attachmentCharsPerFile: S, onModeChange: C, auto: w, onStartVoiceSession: T }) => {
|
|
19
|
+
let E = n(), { locale: D } = e(), O = d(null), [k, A] = f(""), [j, M] = f(!1), N = d(0), { attachments: P, isBusy: F, preparingCount: I, sendBlocker: L, rejection: R, addFiles: z, remove: B, retry: V, clear: H, clearRejection: se, canAddMore: U } = c({ perFileChars: S }), W = l((e) => {
|
|
20
|
+
A((t) => t ? `${t.replace(/\s+$/, "")} ${e}` : e);
|
|
21
|
+
}, []), G = ne((e) => e.assistantLanguage), K = t({
|
|
22
|
+
onFinalize: W,
|
|
23
|
+
language: ie(() => r(G, D), [G, D]).tag
|
|
24
|
+
}), ce = y ?? E("composer.placeholder", "Ask me anything…"), q = k.trim(), J = te(P), Y = P.filter((e) => e.status === "error"), X = (q.length > 0 || J.length > 0) && !v && L === null;
|
|
25
25
|
u(() => {
|
|
26
|
-
let e =
|
|
27
|
-
e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight,
|
|
28
|
-
}, [
|
|
26
|
+
let e = O.current;
|
|
27
|
+
e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, h)}px`);
|
|
28
|
+
}, [k]);
|
|
29
29
|
let Z = l(() => {
|
|
30
|
-
X && (
|
|
30
|
+
X && (K.isActive && K.stop(), _(k.trim(), J), A(""), H());
|
|
31
31
|
}, [
|
|
32
32
|
X,
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
_,
|
|
34
|
+
k,
|
|
35
35
|
J,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
]),
|
|
36
|
+
H,
|
|
37
|
+
K
|
|
38
|
+
]), le = l((e) => {
|
|
39
39
|
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), Z());
|
|
40
|
-
}, [Z]),
|
|
40
|
+
}, [Z]), Q = l((e) => {
|
|
41
41
|
let t = Array.from(e.clipboardData?.files ?? []);
|
|
42
|
-
t.length !== 0 && (e.preventDefault(),
|
|
43
|
-
}, [
|
|
44
|
-
Array.from(e.dataTransfer?.types ?? []).includes("Files") && (
|
|
45
|
-
}, []),
|
|
46
|
-
|
|
47
|
-
}, []), de = l((e) => {
|
|
48
|
-
Array.from(e.dataTransfer?.types ?? []).includes("Files") && e.preventDefault();
|
|
42
|
+
t.length !== 0 && (e.preventDefault(), z(t));
|
|
43
|
+
}, [z]), ue = l((e) => {
|
|
44
|
+
Array.from(e.dataTransfer?.types ?? []).includes("Files") && (N.current += 1, M(!0));
|
|
45
|
+
}, []), de = l(() => {
|
|
46
|
+
N.current = Math.max(0, N.current - 1), N.current === 0 && M(!1);
|
|
49
47
|
}, []), fe = l((e) => {
|
|
50
|
-
|
|
51
|
-
}, [
|
|
48
|
+
Array.from(e.dataTransfer?.types ?? []).includes("Files") && e.preventDefault();
|
|
49
|
+
}, []), pe = l((e) => {
|
|
50
|
+
e.preventDefault(), N.current = 0, M(!1), z(e.dataTransfer?.files ?? null);
|
|
51
|
+
}, [z]), me = (e) => {
|
|
52
52
|
switch (e) {
|
|
53
|
-
case "too-many": return
|
|
54
|
-
case "too-large": return
|
|
55
|
-
case "empty": return
|
|
56
|
-
case "unreadable": return
|
|
57
|
-
case "unsupported-image": return
|
|
53
|
+
case "too-many": return E("attachments.tooMany", "You can attach up to {{max}} files per message.", { max: 5 });
|
|
54
|
+
case "too-large": return E("attachments.tooLarge", "That file is larger than 10 MB.");
|
|
55
|
+
case "empty": return E("attachments.empty", "That file is empty.");
|
|
56
|
+
case "unreadable": return E("attachments.unreadable", "That file could not be read.");
|
|
57
|
+
case "unsupported-image": return E("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.");
|
|
58
58
|
}
|
|
59
59
|
}, $ = (() => {
|
|
60
|
-
switch (
|
|
61
|
-
case "not-allowed": return
|
|
62
|
-
case "audio-capture": return
|
|
63
|
-
case "network": return
|
|
64
|
-
case "language-not-supported": return
|
|
65
|
-
case "unknown": return
|
|
60
|
+
switch (K.error) {
|
|
61
|
+
case "not-allowed": return E("voice.denied", "Microphone access is blocked. Allow it in your browser settings to dictate.");
|
|
62
|
+
case "audio-capture": return E("voice.noMic", "No microphone was found.");
|
|
63
|
+
case "network": return E("voice.network", "Speech recognition is offline right now.");
|
|
64
|
+
case "language-not-supported": return E("voice.languageNotSupported", "This browser cannot recognise spoken {{language}}. Try a different browser, or type instead.", { language: ee(K.language, D) });
|
|
65
|
+
case "unknown": return E("voice.failed", "Dictation stopped unexpectedly.");
|
|
66
66
|
default: return null;
|
|
67
67
|
}
|
|
68
68
|
})();
|
|
69
|
-
return /* @__PURE__ */
|
|
69
|
+
return /* @__PURE__ */ m("div", {
|
|
70
70
|
className: "flex-shrink-0 px-3 pb-3 pt-1.5",
|
|
71
71
|
children: [
|
|
72
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ m("div", {
|
|
73
73
|
onDragEnter: ue,
|
|
74
|
-
onDragLeave:
|
|
75
|
-
onDragOver:
|
|
76
|
-
onDrop:
|
|
77
|
-
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 ${
|
|
74
|
+
onDragLeave: de,
|
|
75
|
+
onDragOver: fe,
|
|
76
|
+
onDrop: pe,
|
|
77
|
+
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 ${j ? "border-action-primary-bg border-dashed bg-action-primary-bg/5" : "border-border-default bg-bg-sunken"}`,
|
|
78
78
|
"data-testid": "assistant-composer",
|
|
79
79
|
children: [
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
attachments:
|
|
82
|
-
onRemove:
|
|
83
|
-
onRetry:
|
|
84
|
-
disabled:
|
|
85
|
-
preparingCount:
|
|
80
|
+
/* @__PURE__ */ p(i, {
|
|
81
|
+
attachments: P,
|
|
82
|
+
onRemove: B,
|
|
83
|
+
onRetry: V,
|
|
84
|
+
disabled: v,
|
|
85
|
+
preparingCount: I
|
|
86
86
|
}),
|
|
87
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ m("div", {
|
|
88
88
|
className: "flex items-end gap-2",
|
|
89
89
|
children: [
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
onFiles:
|
|
92
|
-
canAddMore:
|
|
93
|
-
disabled:
|
|
90
|
+
/* @__PURE__ */ p(re, {
|
|
91
|
+
onFiles: z,
|
|
92
|
+
canAddMore: U,
|
|
93
|
+
disabled: v
|
|
94
94
|
}),
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
ref:
|
|
97
|
-
value:
|
|
98
|
-
onChange: (e) =>
|
|
99
|
-
onKeyDown:
|
|
100
|
-
onPaste:
|
|
101
|
-
disabled:
|
|
102
|
-
placeholder:
|
|
95
|
+
/* @__PURE__ */ p("textarea", {
|
|
96
|
+
ref: O,
|
|
97
|
+
value: k,
|
|
98
|
+
onChange: (e) => A(e.target.value),
|
|
99
|
+
onKeyDown: le,
|
|
100
|
+
onPaste: Q,
|
|
101
|
+
disabled: v,
|
|
102
|
+
placeholder: j ? E("composer.dropHere", "Drop files to attach") : ce,
|
|
103
103
|
rows: 1,
|
|
104
104
|
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",
|
|
105
|
-
"aria-label":
|
|
105
|
+
"aria-label": E("chatInput.ariaLabel", "Message input"),
|
|
106
106
|
"data-testid": "assistant-input"
|
|
107
107
|
}),
|
|
108
|
-
|
|
109
|
-
isListening:
|
|
110
|
-
isStarting:
|
|
111
|
-
onToggle:
|
|
112
|
-
disabled:
|
|
108
|
+
K.isSupported && /* @__PURE__ */ p(o, {
|
|
109
|
+
isListening: K.isListening,
|
|
110
|
+
isStarting: K.isStarting,
|
|
111
|
+
onToggle: K.toggle,
|
|
112
|
+
disabled: v
|
|
113
113
|
}),
|
|
114
|
-
|
|
115
|
-
onStart:
|
|
116
|
-
disabled:
|
|
117
|
-
}) : /* @__PURE__ */
|
|
114
|
+
T && q.length === 0 && P.length === 0 && !K.isActive ? /* @__PURE__ */ p(s, {
|
|
115
|
+
onStart: T,
|
|
116
|
+
disabled: v
|
|
117
|
+
}) : /* @__PURE__ */ p("button", {
|
|
118
118
|
type: "button",
|
|
119
119
|
onClick: Z,
|
|
120
120
|
disabled: !X,
|
|
121
121
|
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 ${X ? "bg-action-primary-bg text-action-primary-text hover:scale-105 hover:bg-action-primary-bg-hover" : "bg-bg-elevated text-text-muted"}`,
|
|
122
|
-
"aria-label":
|
|
122
|
+
"aria-label": E("chatInput.send", "Send message"),
|
|
123
123
|
"data-testid": "assistant-send",
|
|
124
|
-
children:
|
|
124
|
+
children: v || F ? /* @__PURE__ */ p(oe, { className: "size-4 motion-safe:animate-spin" }) : /* @__PURE__ */ p(ae, { className: "size-4" })
|
|
125
125
|
})
|
|
126
126
|
]
|
|
127
127
|
}),
|
|
128
|
-
|
|
128
|
+
x.length > 1 && /* @__PURE__ */ p("div", {
|
|
129
129
|
className: "mt-2 px-0.5",
|
|
130
|
-
children: /* @__PURE__ */
|
|
131
|
-
mode:
|
|
132
|
-
availableModes:
|
|
133
|
-
onModeChange:
|
|
134
|
-
disabled:
|
|
130
|
+
children: /* @__PURE__ */ p(a, {
|
|
131
|
+
mode: b,
|
|
132
|
+
availableModes: x,
|
|
133
|
+
onModeChange: C,
|
|
134
|
+
disabled: v,
|
|
135
|
+
auto: w
|
|
135
136
|
})
|
|
136
137
|
})
|
|
137
138
|
]
|
|
138
139
|
}),
|
|
139
|
-
|
|
140
|
+
g ? /* @__PURE__ */ p("p", {
|
|
140
141
|
className: "mt-1.5 px-1 text-center text-[11px] text-status-warning",
|
|
141
142
|
"data-testid": "assistant-write-access-warning",
|
|
142
|
-
children:
|
|
143
|
+
children: E("composer.writeAccessDenied", "Changes may not save — your role in this workspace does not currently allow edits. You can still plan and review an action.")
|
|
143
144
|
}) : null,
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ p("div", {
|
|
145
146
|
className: "mt-1.5 px-1 text-center text-[11px]",
|
|
146
147
|
"aria-live": "polite",
|
|
147
|
-
children:
|
|
148
|
+
children: K.isStarting && !K.isListening ? /* @__PURE__ */ p("p", {
|
|
148
149
|
className: "text-text-muted",
|
|
149
150
|
"data-testid": "assistant-voice-starting",
|
|
150
|
-
children:
|
|
151
|
-
}) :
|
|
151
|
+
children: E("voice.starting", "Starting the microphone…")
|
|
152
|
+
}) : K.isListening ? /* @__PURE__ */ m("p", {
|
|
152
153
|
className: "text-status-error-text",
|
|
153
154
|
"data-testid": "assistant-voice-status",
|
|
154
|
-
children: [/* @__PURE__ */
|
|
155
|
-
}) : $ ? /* @__PURE__ */
|
|
155
|
+
children: [/* @__PURE__ */ p("span", { className: "mr-1 inline-block size-1.5 rounded-full bg-status-error-text align-middle motion-safe:animate-pulse" }), K.interim || E("voice.listening", "Listening… speak now, tap the square to stop")]
|
|
156
|
+
}) : $ ? /* @__PURE__ */ p("p", {
|
|
156
157
|
className: "text-status-error-text",
|
|
157
158
|
"data-testid": "assistant-voice-error",
|
|
158
159
|
children: $
|
|
159
|
-
}) :
|
|
160
|
+
}) : R ? /* @__PURE__ */ p("button", {
|
|
160
161
|
type: "button",
|
|
161
|
-
onClick:
|
|
162
|
+
onClick: se,
|
|
162
163
|
className: "text-status-error-text underline-offset-2 hover:underline",
|
|
163
164
|
"data-testid": "assistant-attachment-rejection",
|
|
164
|
-
children:
|
|
165
|
-
}) :
|
|
165
|
+
children: me(R)
|
|
166
|
+
}) : L === "failed" ? /* @__PURE__ */ p("p", {
|
|
166
167
|
className: "text-status-error-text",
|
|
167
168
|
"data-testid": "assistant-attachment-blocked",
|
|
168
|
-
children: Y.length === 1 ?
|
|
169
|
-
}) : /* @__PURE__ */
|
|
169
|
+
children: Y.length === 1 ? E("attachments.blockedOne", "{{name}} didn't upload. Retry or remove it before sending.", { name: Y[0].filename }) : E("attachments.blockedMany", "{{count}} attachments didn't upload. Retry or remove them before sending.", { count: Y.length })
|
|
170
|
+
}) : /* @__PURE__ */ p("p", {
|
|
170
171
|
className: "text-text-muted",
|
|
171
|
-
children:
|
|
172
|
+
children: E("composer.hint", "Enter to send · Shift+Enter for newline · drag or paste files to attach")
|
|
172
173
|
})
|
|
173
174
|
})
|
|
174
175
|
]
|
|
175
176
|
});
|
|
176
177
|
};
|
|
177
178
|
//#endregion
|
|
178
|
-
export {
|
|
179
|
+
export { g as AssistantComposer };
|
|
@@ -8,7 +8,27 @@ interface Props {
|
|
|
8
8
|
availableModes: AssistantModeConfig[];
|
|
9
9
|
onModeChange: (mode: AssistantMode) => void;
|
|
10
10
|
disabled?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Offer Auto as the first pill (BOFF-7800). Absent where Auto is not offered.
|
|
13
|
+
* `active` is whether it is selected; `mode` then says where Auto has routed
|
|
14
|
+
* the open conversation, which the pill names once that is the write mode.
|
|
15
|
+
*/
|
|
16
|
+
auto?: AssistantAutoOption;
|
|
11
17
|
}
|
|
18
|
+
export interface AssistantAutoOption {
|
|
19
|
+
active: boolean;
|
|
20
|
+
onSelect: () => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The pill id Auto uses inside the radiogroup — how a keypress finds the pill it
|
|
24
|
+
* came from.
|
|
25
|
+
*
|
|
26
|
+
* ★★ Deliberately NOT a legal mode id: the colon is outside
|
|
27
|
+
* `PRODUCT_ASSISTANT_MODE_ID_PATTERN`. A product may declare a mode called
|
|
28
|
+
* `auto`, and with a plain "auto" here its pill would share this id, so picking
|
|
29
|
+
* it would select Auto instead and the arrow keys could not tell the two apart.
|
|
30
|
+
*/
|
|
31
|
+
export declare const AUTO_MODE_OPTION_ID = ":auto";
|
|
12
32
|
/**
|
|
13
33
|
* Per-mode presentation metadata: the icon, and the shared English name used
|
|
14
34
|
* when a product's `label` is empty ('Ask' / 'Take action'), while the mode ID
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantModeSelector.d.ts","sourceRoot":"","sources":["../../../../../src/shared/assistant/ui/composer/AssistantModeSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AssistantModeSelector.d.ts","sourceRoot":"","sources":["../../../../../src/shared/assistant/ui/composer/AssistantModeSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,EAAE,EAER,MAAM,OAAO,CAAC;AACf,OAAO,EAKL,KAAK,UAAU,EAChB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAI9D,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAQvE,UAAU,KAAK;IACb,IAAI,EAAE,aAAa,CAAC;IACpB,iFAAiF;IACjF,cAAc,EAAE,mBAAmB,EAAE,CAAC;IACtC,YAAY,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,mBAAmB,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAE3C;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CACtC,oBAAoB,EACpB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAsBxD,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE;IAC5C,EAAE,EAAE,aAAa,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAQzC;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAgBf;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,KAAK,CAqN3C,CAAC"}
|
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
import { useAssistantTr as e } from "../../i18n.js";
|
|
2
2
|
import { ASSISTANT_MODE_FALLBACK_LABELS as t, assistantModeFallbackLabel as n, isBuiltInAssistantMode as r } from "../../modeCopy.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { AUTO_WRITE_MODE as i } from "../../autoRouting.js";
|
|
4
|
+
import { useCallback as a, useId as o, useMemo as s, useRef as c } from "react";
|
|
5
|
+
import { ShieldCheck as l, Sparkles as u, Wand2 as d, Zap as f } from "lucide-react";
|
|
6
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
6
7
|
//#region src/shared/assistant/ui/composer/AssistantModeSelector.tsx
|
|
7
|
-
var
|
|
8
|
+
var h = ":auto", g = {
|
|
8
9
|
general: {
|
|
9
10
|
i18nKey: "mode.ask",
|
|
10
11
|
fallback: t.general,
|
|
11
|
-
icon:
|
|
12
|
+
icon: u
|
|
12
13
|
},
|
|
13
14
|
assistant: {
|
|
14
15
|
i18nKey: "mode.ask",
|
|
15
16
|
fallback: t.assistant,
|
|
16
|
-
icon:
|
|
17
|
+
icon: u
|
|
17
18
|
},
|
|
18
19
|
"api-calls": {
|
|
19
20
|
i18nKey: "mode.takeAction",
|
|
20
21
|
fallback: t["api-calls"],
|
|
21
|
-
icon:
|
|
22
|
+
icon: l
|
|
22
23
|
},
|
|
23
24
|
"vibe-plugins": {
|
|
24
25
|
i18nKey: "mode.build",
|
|
25
26
|
fallback: t["vibe-plugins"],
|
|
26
|
-
icon:
|
|
27
|
+
icon: f
|
|
27
28
|
}
|
|
28
29
|
};
|
|
29
|
-
function
|
|
30
|
-
return r(e.id) ?
|
|
30
|
+
function _(e) {
|
|
31
|
+
return r(e.id) ? g[e.id] : {
|
|
31
32
|
fallback: n(e),
|
|
32
|
-
icon: e.producesArtifacts === !0 ?
|
|
33
|
+
icon: e.producesArtifacts === !0 ? f : u
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
+
function v(e, t, n) {
|
|
36
37
|
switch (e) {
|
|
37
38
|
case "Home": return 0;
|
|
38
39
|
case "End": return n;
|
|
@@ -43,46 +44,89 @@ function p(e, t, n) {
|
|
|
43
44
|
default: return null;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
var
|
|
47
|
-
let
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
let
|
|
53
|
-
|
|
47
|
+
var y = ({ mode: t, availableModes: n, onModeChange: r, disabled: l = !1, auto: u }) => {
|
|
48
|
+
let f = e(), g = c(null), y = o(), b = u !== void 0, x = s(() => [...b ? [h] : [], ...n.map((e) => e.id)], [b, n]), S = u?.active ? h : t, C = x.includes(S) ? S : x[0] ?? null, w = a((e) => {
|
|
49
|
+
if (e === ":auto") {
|
|
50
|
+
u?.onSelect();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
let t = n.find((t) => t.id === e);
|
|
54
|
+
t && r(t.id);
|
|
54
55
|
}, [
|
|
56
|
+
u,
|
|
55
57
|
n,
|
|
56
|
-
o,
|
|
57
|
-
t,
|
|
58
58
|
r
|
|
59
|
-
])
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
]), T = a((e) => {
|
|
60
|
+
if (l) return;
|
|
61
|
+
let t = e.target?.closest("[data-mode-id]")?.dataset.modeId, n = t ? x.indexOf(t) : -1, r = n >= 0 ? n : x.indexOf(S), i = v(e.key, r, x.length - 1);
|
|
62
|
+
if (i === null) return;
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
let a = x[i];
|
|
65
|
+
a !== void 0 && (g.current?.querySelector(`[data-mode-id="${a}"]`)?.focus(), a !== S && w(a));
|
|
66
|
+
}, [
|
|
67
|
+
l,
|
|
68
|
+
x,
|
|
69
|
+
S,
|
|
70
|
+
w
|
|
71
|
+
]), E = !!u?.active && t === "api-calls", D = n.find((e) => e.id === i);
|
|
72
|
+
return n.length < 2 ? null : /* @__PURE__ */ m("div", {
|
|
73
|
+
ref: g,
|
|
62
74
|
role: "radiogroup",
|
|
63
|
-
"aria-label":
|
|
64
|
-
onKeyDown:
|
|
65
|
-
className: "inline-flex max-w-full items-center gap-1 overflow-x-auto rounded-full border border-border-subtle bg-bg-elevated p-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
75
|
+
"aria-label": f("modeSelector.ariaLabel", "Select assistant mode"),
|
|
76
|
+
onKeyDown: T,
|
|
77
|
+
className: "relative inline-flex max-w-full items-center gap-1 overflow-x-auto rounded-full border border-border-subtle bg-bg-elevated p-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
66
78
|
"data-testid": "assistant-mode-selector",
|
|
67
|
-
children:
|
|
68
|
-
|
|
69
|
-
return /* @__PURE__ */ u("button", {
|
|
79
|
+
children: [
|
|
80
|
+
u ? /* @__PURE__ */ m("button", {
|
|
70
81
|
type: "button",
|
|
71
82
|
role: "radio",
|
|
72
|
-
"aria-checked":
|
|
73
|
-
tabIndex:
|
|
74
|
-
disabled:
|
|
75
|
-
onClick: () =>
|
|
76
|
-
"data-mode-id":
|
|
77
|
-
|
|
78
|
-
"
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
"aria-checked": u.active,
|
|
84
|
+
tabIndex: C === ":auto" ? 0 : -1,
|
|
85
|
+
disabled: l,
|
|
86
|
+
onClick: () => w(h),
|
|
87
|
+
"data-mode-id": h,
|
|
88
|
+
"aria-describedby": y,
|
|
89
|
+
title: f("modeSelector.autoHint", "Answers your questions, and proposes changes for you to approve"),
|
|
90
|
+
className: `flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-3 py-1.5 text-[13px] font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:opacity-50 ${u.active ? "bg-action-primary-bg text-action-primary-text shadow-sm" : "text-text-secondary hover:bg-bg-surface hover:text-text-primary"}`,
|
|
91
|
+
"data-testid": "assistant-mode-auto",
|
|
92
|
+
"data-auto-routed": E ? i : void 0,
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ p(d, {
|
|
95
|
+
className: "size-3.5",
|
|
96
|
+
"aria-hidden": "true"
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ p("span", { children: f("modeSelector.auto", "Auto") }),
|
|
99
|
+
E && D ? /* @__PURE__ */ m("span", {
|
|
100
|
+
className: "opacity-80",
|
|
101
|
+
children: ["· ", f(`mode.${D.id}`, D.label || _(D).fallback)]
|
|
102
|
+
}) : null
|
|
103
|
+
]
|
|
104
|
+
}) : null,
|
|
105
|
+
n.map((e) => {
|
|
106
|
+
let n = _(e), r = n.icon, i = !u?.active && e.id === t;
|
|
107
|
+
return /* @__PURE__ */ m("button", {
|
|
108
|
+
type: "button",
|
|
109
|
+
role: "radio",
|
|
110
|
+
"aria-checked": i,
|
|
111
|
+
tabIndex: C === e.id ? 0 : -1,
|
|
112
|
+
disabled: l,
|
|
113
|
+
onClick: () => w(e.id),
|
|
114
|
+
"data-mode-id": e.id,
|
|
115
|
+
className: `flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-3 py-1.5 text-[13px] font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:opacity-50 ${i ? "bg-action-primary-bg text-action-primary-text shadow-sm" : "text-text-secondary hover:bg-bg-surface hover:text-text-primary"}`,
|
|
116
|
+
"data-testid": `assistant-mode-option-${e.id}`,
|
|
117
|
+
children: [/* @__PURE__ */ p(r, {
|
|
118
|
+
className: "size-3.5",
|
|
119
|
+
"aria-hidden": "true"
|
|
120
|
+
}), /* @__PURE__ */ p("span", { children: f(`mode.${e.id}`, e.label || n.fallback) })]
|
|
121
|
+
}, e.id);
|
|
122
|
+
}),
|
|
123
|
+
u ? /* @__PURE__ */ p("span", {
|
|
124
|
+
id: y,
|
|
125
|
+
className: "sr-only left-0 top-0",
|
|
126
|
+
children: f("modeSelector.autoHint", "Answers your questions, and proposes changes for you to approve")
|
|
127
|
+
}) : null
|
|
128
|
+
]
|
|
85
129
|
});
|
|
86
130
|
};
|
|
87
131
|
//#endregion
|
|
88
|
-
export {
|
|
132
|
+
export { g as ASSISTANT_MODE_META, h as AUTO_MODE_OPTION_ID, y as AssistantModeSelector, _ as assistantModeMeta, v as nextModeIndex };
|