@burdenoff/fe-libs 2026.1114.12 → 2026.1114.13

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.
@@ -0,0 +1,64 @@
1
+ import { FC, RefObject } from 'react';
2
+ import { AssistantAttachment } from '../../attachments';
3
+ import { LiveLevelSource } from '../../voice/liveLevel';
4
+ import { VoiceStageState } from '../../voice/voiceStageState';
5
+ import { HandsFreePrivacyNoticeActions } from '../../voice/handsfree/useHandsFreeInterrupt';
6
+ export interface AssistantPageVoiceBarProps {
7
+ /** The session's root and End button: its Escape, focus and return-focus rules use them. */
8
+ rootRef: RefObject<HTMLDivElement | null>;
9
+ endRef: RefObject<HTMLButtonElement | null>;
10
+ stage: VoiceStageState;
11
+ muted: boolean;
12
+ /** The status the session composed (what is announced), its suffix, and whether it rotates. */
13
+ status: string;
14
+ statusSuffix: string | null;
15
+ rotateStatus: boolean;
16
+ /** What the person is saying, as it is heard; empty when not listening. */
17
+ heard: string;
18
+ /** The waveform's level (`useLiveLevel`). */
19
+ level: LiveLevelSource;
20
+ /** A recoverable problem, shown above the box, and the same text when it is to be announced. */
21
+ notice: string | null;
22
+ announcedNotice: string | null;
23
+ attachmentNotice: string | null;
24
+ /** "Started a voice conversation…": undefined renders nothing, not even the status region. */
25
+ startedCue?: string | null;
26
+ errorText: string | null;
27
+ attachments: AssistantAttachment[];
28
+ preparingAttachments: number;
29
+ attachmentsLocked: boolean;
30
+ canAttachMore: boolean;
31
+ onAttachFiles?: (files: FileList | null) => void;
32
+ onPickerOpen: () => void;
33
+ onRemoveAttachment?: (id: string) => void;
34
+ onRetryAttachment?: (id: string) => void;
35
+ /** "Let me finish" / "I'm done" (H1), when offered. */
36
+ hold: {
37
+ holding: boolean;
38
+ onPress: () => void;
39
+ } | null;
40
+ /** The microphone control: Stop the assistant while it talks, Mute / Unmute otherwise. */
41
+ primary: {
42
+ interrupt: boolean;
43
+ onPress?: () => void;
44
+ disabled: boolean;
45
+ };
46
+ onEnd: () => void;
47
+ privacyNotice: HandsFreePrivacyNoticeActions | null;
48
+ }
49
+ /**
50
+ * The live voice conversation on a page (BOFF-13461; the operator, 14 Nov: "in
51
+ * /assistant… the voice assistant still uses the panel ui… use same chat ui").
52
+ *
53
+ * The page's thread IS the conversation: what the person says and what the
54
+ * assistant answers are turns of it, drawn by the chat area like typed ones. This
55
+ * is only the box at the foot of the column, in the message box's place and in its
56
+ * shape: what is being heard (or the status), a live waveform, and the controls,
57
+ * Attach, Let me finish / I'm done, the microphone (Stop the assistant while it
58
+ * talks; Mute / Unmute otherwise) and End. Notices sit above it, where the message
59
+ * box keeps its status line.
60
+ *
61
+ * All the session's state and rules stay in `AssistantVoiceSession` (`view="page"`),
62
+ * which renders this through a portal into the page's slot.
63
+ */
64
+ export declare const AssistantPageVoiceBar: FC<AssistantPageVoiceBarProps>;
@@ -0,0 +1,183 @@
1
+ import { useAssistantTr as e } from "../../i18n.js";
2
+ import { PAGE_COLUMN as t } from "../assistantPageLayout.js";
3
+ import { ASSISTANT_VOICE_SESSION_ATTR as n } from "../panelOverlays.js";
4
+ import { AssistantAttachmentButton as r } from "../composer/AssistantAttachmentButton.js";
5
+ import { AssistantAttachmentChips as i } from "../composer/AssistantAttachmentChips.js";
6
+ import { HandsFreePrivacyNotice as a } from "./HandsFreePrivacyNotice.js";
7
+ import { LiveWaveform as o } from "./LiveWaveform.js";
8
+ import { VoiceStatusText as s } from "./VoiceStatusText.js";
9
+ import { Mic as c, MicOff as l, Square as u, X as d } from "lucide-react";
10
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
11
+ // src/shared/assistant/ui/voice/AssistantPageVoiceBar.tsx
12
+ var h = ({ notice: e, announcedNotice: t, attachmentNotice: n, startedCue: r, errorText: i }) => /* @__PURE__ */ m(f, { children: [
13
+ /* @__PURE__ */ m("div", {
14
+ className: "flex flex-col items-center gap-1 px-1 text-center text-xs empty:hidden [&:not(:empty)]:pb-1.5",
15
+ "data-testid": "assistant-voice-page-notices",
16
+ children: [
17
+ e ? /* @__PURE__ */ p("p", {
18
+ className: "text-status-warning",
19
+ "data-testid": "assistant-voice-notice",
20
+ children: e
21
+ }) : null,
22
+ n ? /* @__PURE__ */ p("p", {
23
+ className: "text-status-warning",
24
+ role: "status",
25
+ "aria-live": "polite",
26
+ "data-testid": "assistant-voice-attachment-notice",
27
+ children: n
28
+ }) : null,
29
+ r ? /* @__PURE__ */ p("p", {
30
+ className: "text-text-secondary",
31
+ "data-testid": "assistant-voice-started-cue",
32
+ children: r
33
+ }) : null,
34
+ i ? /* @__PURE__ */ p("p", {
35
+ className: "text-status-error-text",
36
+ "data-testid": "assistant-voice-error",
37
+ children: i
38
+ }) : null
39
+ ]
40
+ }),
41
+ /* @__PURE__ */ p("span", {
42
+ className: "sr-only",
43
+ role: "status",
44
+ "aria-live": "polite",
45
+ "aria-atomic": "true",
46
+ "data-testid": "assistant-voice-notice-announced",
47
+ children: t
48
+ }),
49
+ r === void 0 ? null : /* @__PURE__ */ p("span", {
50
+ className: "sr-only",
51
+ role: "status",
52
+ "aria-live": "polite",
53
+ "aria-atomic": "true",
54
+ "data-testid": "assistant-voice-started-cue-announced",
55
+ children: r
56
+ })
57
+ ] }), g = ({ heard: e, status: t, statusSuffix: n, rotateStatus: r }) => /* @__PURE__ */ m("div", {
58
+ className: "min-h-10 px-4 pb-1 pt-3 text-base leading-6",
59
+ children: [e ? /* @__PURE__ */ p("p", {
60
+ className: "line-clamp-3 text-text-primary",
61
+ "data-testid": "assistant-voice-heard",
62
+ children: e
63
+ }) : null, /* @__PURE__ */ p(s, {
64
+ status: t,
65
+ suffix: n,
66
+ rotating: r,
67
+ className: e ? "sr-only" : "text-text-muted"
68
+ })]
69
+ }), _ = ({ holding: t, onPress: n }) => {
70
+ let r = e();
71
+ return /* @__PURE__ */ p("button", {
72
+ type: "button",
73
+ onClick: n,
74
+ className: `flex h-9 shrink-0 items-center justify-center rounded-full border px-3 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] ${t ? "border-transparent bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg-hover" : "border-border-default bg-bg-elevated text-text-secondary hover:bg-bg-sunken"}`,
75
+ title: t ? r("voiceSession.imDoneHint", "Send what you said now") : r("voiceSession.letMeFinishHint", "Pause sending until you tap “I’m done”"),
76
+ "data-testid": "assistant-voice-hold",
77
+ "data-holding": t ? "true" : "false",
78
+ children: t ? r("voiceSession.imDone", "I’m done") : r("voiceSession.letMeFinish", "Let me finish")
79
+ });
80
+ }, v = ({ primary: t, muted: n, stage: r }) => {
81
+ let i = e(), a = t.interrupt ? i("voiceSession.interrupt", "Stop the assistant and speak") : n ? i("voiceSession.unmute", "Turn the microphone on") : i("voiceSession.mute", "Turn the microphone off"), o = t.interrupt ? "bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg-hover" : n ? "bg-status-error-bg/15 text-status-error-text hover:bg-status-error-bg/25" : "text-text-secondary hover:bg-bg-sunken hover:text-text-primary", s = t.interrupt ? /* @__PURE__ */ p(u, {
82
+ className: "size-4 fill-current",
83
+ "aria-hidden": "true"
84
+ }) : p(n ? l : c, {
85
+ className: "size-5",
86
+ "aria-hidden": "true"
87
+ });
88
+ return /* @__PURE__ */ p("button", {
89
+ type: "button",
90
+ onClick: t.onPress,
91
+ disabled: t.disabled,
92
+ className: `flex size-11 shrink-0 items-center justify-center rounded-full transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] disabled:cursor-default disabled:opacity-50 sm:size-10 ${o}`,
93
+ "aria-label": a,
94
+ title: a,
95
+ "aria-pressed": t.interrupt ? void 0 : n,
96
+ "data-testid": "assistant-voice-primary",
97
+ "data-state": r,
98
+ "data-muted": n || void 0,
99
+ children: s
100
+ });
101
+ }, y = ({ endRef: t, onEnd: n }) => {
102
+ let r = e();
103
+ return /* @__PURE__ */ m("button", {
104
+ ref: t,
105
+ type: "button",
106
+ onClick: n,
107
+ className: "flex h-10 shrink-0 items-center justify-center gap-1.5 rounded-full border border-border-default bg-bg-elevated px-3 text-sm font-medium text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
108
+ title: r("voiceSession.end", "End the voice conversation"),
109
+ "data-testid": "assistant-voice-end",
110
+ children: [/* @__PURE__ */ p(d, {
111
+ className: "size-4",
112
+ "aria-hidden": "true"
113
+ }), /* @__PURE__ */ p("span", {
114
+ className: "max-w-[6rem] truncate whitespace-nowrap",
115
+ children: r("voiceSession.endShort", "End")
116
+ })]
117
+ });
118
+ }, b = (s) => {
119
+ let c = e(), { rootRef: l, stage: u, attachments: d, preparingAttachments: f, attachmentsLocked: b } = s, { onAttachFiles: x, hold: S, privacyNotice: C } = s, w = d.length > 0 || f > 0;
120
+ return /* @__PURE__ */ m("div", {
121
+ ref: l,
122
+ role: "region",
123
+ "aria-label": c("voiceSession.title", "Voice conversation"),
124
+ className: `relative flex-shrink-0 px-3 pt-1.5 ${t}`,
125
+ "data-testid": "assistant-voice-session",
126
+ "data-presentation": "page",
127
+ [n]: "",
128
+ children: [
129
+ /* @__PURE__ */ p(h, { ...s }),
130
+ /* @__PURE__ */ m("div", {
131
+ className: "flex flex-col rounded-3xl border border-[var(--color-focus-ring)] bg-bg-elevated ring-1 ring-[var(--color-focus-ring)]",
132
+ "data-testid": "assistant-voice-page-bar",
133
+ "data-state": u,
134
+ children: [
135
+ w ? /* @__PURE__ */ p("div", {
136
+ className: "px-3 pt-3",
137
+ "data-testid": "assistant-voice-attachments",
138
+ children: /* @__PURE__ */ p(i, {
139
+ attachments: d,
140
+ onRemove: s.onRemoveAttachment ?? (() => void 0),
141
+ onRetry: s.onRetryAttachment ?? (() => void 0),
142
+ preparingCount: f,
143
+ disabled: b
144
+ })
145
+ }) : null,
146
+ /* @__PURE__ */ p(g, { ...s }),
147
+ /* @__PURE__ */ m("div", {
148
+ className: "flex flex-nowrap items-center gap-2 px-1.5 pb-1.5 pt-1",
149
+ "data-testid": "assistant-voice-page-controls",
150
+ children: [
151
+ x ? /* @__PURE__ */ p(r, {
152
+ onFiles: x,
153
+ onPickerOpen: s.onPickerOpen,
154
+ canAddMore: s.canAttachMore,
155
+ disabled: b,
156
+ compact: !0,
157
+ capMenuHeight: !0
158
+ }) : null,
159
+ /* @__PURE__ */ p(o, {
160
+ source: s.level,
161
+ tone: u === "speaking" ? "speaking" : "listening",
162
+ className: "h-8 flex-1",
163
+ testId: "assistant-voice-waveform"
164
+ }),
165
+ S ? /* @__PURE__ */ p(_, {
166
+ holding: S.holding,
167
+ onPress: S.onPress
168
+ }) : null,
169
+ /* @__PURE__ */ p(v, { ...s }),
170
+ /* @__PURE__ */ p(y, { ...s })
171
+ ]
172
+ })
173
+ ]
174
+ }),
175
+ C ? /* @__PURE__ */ p(a, {
176
+ view: "mini",
177
+ onContinue: C.accept,
178
+ onNotNow: C.decline
179
+ }) : null
180
+ ]
181
+ });
182
+ };
183
+ export { b as AssistantPageVoiceBar };
@@ -125,8 +125,16 @@ interface Props {
125
125
  * ★ HANDOFF: when the control ends, the session was handed to the full
126
126
  * assistant, and it keeps going as the SAME instance: a `compact` view becomes
127
127
  * the `panel` view, and any other view stays what it was. Nothing remounts.
128
+ * - ★ BOFF-13461 `page`: the assistant laid out as a page (`/assistant`). The
129
+ * session is a bar in the page's column, in the message box's place, and the
130
+ * conversation is the page's own thread (the chat area shows the spoken turns
131
+ * there, as a chat app does). No strip, no stage, no transcript drawer and no
132
+ * stepper: the thread is the transcript. Every rule of the session (states,
133
+ * Escape, focus, notices, hold, mute, interrupt, attachments) is the same.
128
134
  */
129
- view?: VoiceView | 'compact';
135
+ view?: VoiceView | 'compact' | 'page';
136
+ /** ★ BOFF-13461: with `view="page"`, the element the bar is drawn in (the chat area's slot). */
137
+ pageSlot?: HTMLElement | null;
130
138
  /**
131
139
  * ★ BOFF-10180 (N3, compact presentation): "Started a voice conversation. Your
132
140
  * chat is in History." — said when this session moved into a conversation of