Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .changeset/voice-kit-components.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
"@schlessera/brain-ui-kit": minor
---

New voice surface components (#3692) for the unified dictation and live-conversation experience. One mic and one field, with one colour language: amber for you and your mic, teal for brain and its voice, grey when nothing is heard, and red only for End and failures.

- `VoiceField`: three shapes. `compact` holds a fixed height while dictating, `tall` is the live panel, and `card` is for Start and notices.
- `VoiceText` and `VoiceMeter`: the words and the level meter.
- `VoiceStateLabel`: an icon and one word for each state.
- `VoiceControlButton`: the raised round controls.
- `MicButton`: the hold ring, the hint and a "Talk live…" action for keyboard and screen readers.
- `VoiceNotice`: a short card for prompts and failures.
- `StartCard`: the disclosure, Service row, persona list, recovery notices and Start button.
- Spoken-turn marks for the chat: `SpokenTurn`, `SpokenMark`, `UncertainWord`, `UnplayedText`, `CutOffTag`, `VoiceToolChip` and `ConversationEndDivider`.
- `VOICE_SKINS` and the `--bk-voice-*` tokens.
- Icon keys: `speaker`, `mic-off` and `interrupt`.

All of these are presentational only: plain props and callbacks, with no dictation or conversation client code. Nothing in the app uses them yet; the ui-react wiring follows in later releases.
239 changes: 239 additions & 0 deletions api-report/ui-kit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export "." (./src/index.ts)
type ContactFact
type ContactKind
type ContactTone
ConversationEndDivider
CutOffTag
DataTable
type DataTableCell
type DataTableColumn
Expand Down Expand Up @@ -169,6 +171,9 @@ export "." (./src/index.ts)
type MessageRole
Meter
type MeterProps
MicButton
type MicButtonProps
type MicPhase
ModelPicker
type ModelPickerProps
type NotificationAction
Expand Down Expand Up @@ -232,6 +237,15 @@ export "." (./src/index.ts)
type SessionStripProps
SideRail
type SideRailProps
type Speaker
SpokenMark
type SpokenMarkProps
SpokenTurn
type SpokenTurnProps
StartCard
type StartCardNotice
type StartCardPersona
type StartCardProps
type StatTile
StatTiles
type StatTilesProps
Expand Down Expand Up @@ -290,8 +304,33 @@ export "." (./src/index.ts)
type TurnErrorAction
TurnErrorCard
type TurnErrorCardProps
UncertainWord
type UncertainWordProps
UnplayedText
VOICE_SKINS
type ValueTone
type ViewState
VoiceControlButton
type VoiceControlButtonProps
VoiceField
type VoiceFieldLabel
type VoiceFieldProps
type VoiceFieldShape
VoiceMeter
type VoiceMeterMode
type VoiceMeterProps
type VoiceMotion
VoiceNotice
type VoiceNoticeAction
type VoiceNoticeProps
type VoiceSkin
VoiceStateLabel
type VoiceStateLabelProps
VoiceText
type VoiceTextProps
type VoiceTone
VoiceToolChip
type VoiceToolChipProps
WORKING_STATES
type WorkingSession
type WorkingSessionView
Expand Down Expand Up @@ -897,6 +936,14 @@ signatures (every public export and the types it is made of)
export type ContactKind = "person" | "company" | "project";
ContactTone (packages/ui-kit/src/types.ts)
export type ContactTone = "teal" | "blue" | "purple" | "amber" | "neutral";
ConversationEndDivider (packages/ui-kit/src/voice/SpokenTurn.tsx)
export function ConversationEndDivider({ label }: {
label: string;
}): import("react").JSX.Element;
CutOffTag (packages/ui-kit/src/voice/SpokenTurn.tsx)
export function CutOffTag({ label = "cut off" }: {
label?: string;
}): import("react").JSX.Element;
DataAttributes (packages/ui-kit/src/chrome/Overlay.tsx)
type DataAttributes = {
[key: `data-${string}`]: string | number | boolean | undefined;
Expand Down Expand Up @@ -1278,6 +1325,7 @@ signatures (every public export and the types it is made of)
const ICONS: {
readonly "calendar-ok": import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
readonly "folder-open": import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
readonly "mic-off": import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
readonly activity: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
readonly add: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
readonly agent: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
Expand Down Expand Up @@ -1322,6 +1370,7 @@ signatures (every public export and the types it is made of)
readonly history: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
readonly image: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
readonly install: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
readonly interrupt: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
readonly later: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
readonly latest: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
readonly ledger: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
Expand Down Expand Up @@ -1349,6 +1398,7 @@ signatures (every public export and the types it is made of)
readonly send: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
readonly settings: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
readonly share: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
readonly speaker: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
readonly steps: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
readonly stopped: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
readonly suggestion: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
Expand Down Expand Up @@ -1629,6 +1679,28 @@ signatures (every public export and the types it is made of)
gradient?: boolean;
labelWidth?: number;
}
MicButton (packages/ui-kit/src/voice/MicButton.tsx)
export function MicButton(p: MicButtonProps): import("react").JSX.Element;
MicButtonProps (packages/ui-kit/src/voice/MicButton.tsx)
export interface MicButtonProps {
phase?: MicPhase;
progress?: number;
hint?: boolean;
name?: string;
hintLabel?: string;
onClick?: () => void;
onPointerDown?: (event: PointerEvent<HTMLButtonElement>) => void;
onPointerUp?: (event: PointerEvent<HTMLButtonElement>) => void;
onPointerLeave?: (event: PointerEvent<HTMLButtonElement>) => void;
onPointerCancel?: (event: PointerEvent<HTMLButtonElement>) => void;
onKeyDown?: (event: KeyboardEvent<HTMLButtonElement>) => void;
onTalkLive?: () => void;
talkLiveLabel?: string;
disabled?: boolean;
motion?: VoiceMotion;
}
MicPhase (packages/ui-kit/src/voice/MicButton.tsx)
export type MicPhase = "idle" | "pressed" | "holding" | "complete";
ModelPicker (packages/ui-kit/src/chrome/ModelPicker.tsx)
export function ModelPicker(p: ModelPickerProps): import("react").JSX.Element;
ModelPickerProps (packages/ui-kit/src/chrome/ModelPicker.tsx)
Expand Down Expand Up @@ -2092,6 +2164,56 @@ signatures (every public export and the types it is made of)
hint?: string | null;
width?: number;
}
Speaker (packages/ui-kit/src/voice/SpokenTurn.tsx)
export type Speaker = "you" | "brain";
SpokenMark (packages/ui-kit/src/voice/SpokenTurn.tsx)
export function SpokenMark(p: SpokenMarkProps): import("react").JSX.Element;
SpokenMarkProps (packages/ui-kit/src/voice/SpokenTurn.tsx)
export interface SpokenMarkProps {
speaker: Speaker;
}
SpokenTurn (packages/ui-kit/src/voice/SpokenTurn.tsx)
export function SpokenTurn(p: SpokenTurnProps): import("react").JSX.Element;
SpokenTurnProps (packages/ui-kit/src/voice/SpokenTurn.tsx)
export interface SpokenTurnProps {
speaker: Speaker;
inProgress?: boolean;
cutOff?: boolean;
children?: ReactNode;
}
StartCard (packages/ui-kit/src/voice/StartCard.tsx)
export function StartCard(p: StartCardProps): import("react").JSX.Element;
StartCardNotice (packages/ui-kit/src/voice/StartCard.tsx)
export interface StartCardNotice {
kind: "warn" | "block" | "error";
text: string;
action?: {
label: string;
onClick?: () => void;
};
}
StartCardPersona (packages/ui-kit/src/voice/StartCard.tsx)
export interface StartCardPersona {
id: string;
name: string;
voice?: string;
}
StartCardProps (packages/ui-kit/src/voice/StartCard.tsx)
export interface StartCardProps {
service: string | null;
disclosure?: string;
shared?: string[];
onChangeService?: () => void;
showService?: boolean;
personas?: StartCardPersona[];
selectedPersona?: string;
onSelectPersona?: (id: string) => void;
notice?: StartCardNotice;
onStart?: () => void;
onCancel?: () => void;
startLabel?: string;
motion?: VoiceMotion;
}
StatTile (packages/ui-kit/src/blocks/StatTiles.tsx)
export interface StatTile {
label: string;
Expand Down Expand Up @@ -2423,10 +2545,127 @@ signatures (every public export and the types it is made of)
busy?: boolean;
retryWarning?: boolean;
}
UncertainWord (packages/ui-kit/src/voice/SpokenTurn.tsx)
export function UncertainWord(p: UncertainWordProps): import("react").JSX.Element;
UncertainWordProps (packages/ui-kit/src/voice/SpokenTurn.tsx)
export interface UncertainWordProps {
children: ReactNode;
onClick?: () => void;
}
UnplayedText (packages/ui-kit/src/voice/SpokenTurn.tsx)
export function UnplayedText({ children }: {
children: ReactNode;
}): import("react").JSX.Element;
VOICE_SKINS (packages/ui-kit/src/voice/tone.ts)
const VOICE_SKINS: Readonly<Record<VoiceTone, VoiceSkin>>;
ValueTone (packages/ui-kit/src/types.ts)
export type ValueTone = Tone | InkTone;
ViewState (packages/ui-kit/src/types.ts)
export type ViewState = "ready" | "loading" | "empty" | "error";
VoiceControlButton (packages/ui-kit/src/voice/VoiceControlButton.tsx)
export function VoiceControlButton(p: VoiceControlButtonProps): import("react").JSX.Element;
VoiceControlButtonProps (packages/ui-kit/src/voice/VoiceControlButton.tsx)
export interface VoiceControlButtonProps {
name: string;
icon: IconName;
tone?: "neutral" | "end" | "you" | "brain";
pressed?: boolean;
disabled?: boolean;
busy?: boolean;
onClick?: () => void;
}
VoiceField (packages/ui-kit/src/voice/VoiceField.tsx)
export function VoiceField(p: VoiceFieldProps): import("react").JSX.Element;
VoiceFieldLabel (packages/ui-kit/src/voice/VoiceField.tsx)
export interface VoiceFieldLabel {
icon: IconName;
word: string;
meta?: string;
spin?: boolean;
live?: "polite" | "assertive";
}
VoiceFieldProps (packages/ui-kit/src/voice/VoiceField.tsx)
export interface VoiceFieldProps {
shape?: VoiceFieldShape;
tone?: VoiceTone;
label?: VoiceFieldLabel;
meter?: VoiceMeterMode;
level?: number;
outline?: boolean;
name?: string;
children?: ReactNode;
trailing?: ReactNode;
controls?: ReactNode;
motion?: VoiceMotion;
}
VoiceFieldShape (packages/ui-kit/src/voice/VoiceField.tsx)
export type VoiceFieldShape = "compact" | "tall" | "card";
VoiceMeter (packages/ui-kit/src/voice/VoiceMeter.tsx)
export function VoiceMeter(p: VoiceMeterProps): import("react").JSX.Element | null;
VoiceMeterMode (packages/ui-kit/src/voice/VoiceMeter.tsx)
export type VoiceMeterMode = "level" | "sweep" | "flat" | "hatch" | "none";
VoiceMeterProps (packages/ui-kit/src/voice/VoiceMeter.tsx)
export interface VoiceMeterProps {
mode?: VoiceMeterMode;
level?: number;
bars?: number;
motion?: VoiceMotion;
}
VoiceMotion (packages/ui-kit/src/voice/tone.ts)
export type VoiceMotion = "auto" | "reduce";
VoiceNotice (packages/ui-kit/src/voice/VoiceNotice.tsx)
export function VoiceNotice(p: VoiceNoticeProps): import("react").JSX.Element;
VoiceNoticeAction (packages/ui-kit/src/voice/VoiceNotice.tsx)
export interface VoiceNoticeAction {
label: string;
onClick?: () => void;
tone?: "you" | "brain";
}
VoiceNoticeProps (packages/ui-kit/src/voice/VoiceNotice.tsx)
export interface VoiceNoticeProps {
tone?: VoiceTone;
icon: IconName;
title: string;
body?: string;
actions?: VoiceNoticeAction[];
live?: "polite" | "assertive";
motion?: VoiceMotion;
}
VoiceSkin (packages/ui-kit/src/voice/tone.ts)
export interface VoiceSkin {
ink: string;
tint: string;
border: string;
bar: string;
}
VoiceStateLabel (packages/ui-kit/src/voice/VoiceStateLabel.tsx)
export function VoiceStateLabel(p: VoiceStateLabelProps): import("react").JSX.Element;
VoiceStateLabelProps (packages/ui-kit/src/voice/VoiceStateLabel.tsx)
export interface VoiceStateLabelProps {
icon: IconName;
word: string;
meta?: string;
spin?: boolean;
live?: "polite" | "assertive";
}
VoiceText (packages/ui-kit/src/voice/VoiceField.tsx)
export function VoiceText(p: VoiceTextProps): import("react").JSX.Element;
VoiceTextProps (packages/ui-kit/src/voice/VoiceField.tsx)
export interface VoiceTextProps {
text?: string;
partial?: string;
placeholder?: string;
children?: ReactNode;
}
VoiceTone (packages/ui-kit/src/voice/tone.ts)
export type VoiceTone = "you" | "brain" | "idle" | "fail";
VoiceToolChip (packages/ui-kit/src/voice/SpokenTurn.tsx)
export function VoiceToolChip(p: VoiceToolChipProps): import("react").JSX.Element;
VoiceToolChipProps (packages/ui-kit/src/voice/SpokenTurn.tsx)
export interface VoiceToolChipProps {
label: string;
state?: "running" | "done";
}
WEB_APP_COLORS (packages/ui-kit/src/brand.ts)
const WEB_APP_COLORS: {
readonly background_color: "#0c1417";
Expand Down
41 changes: 41 additions & 0 deletions packages/ui-kit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,47 @@ Pass `announce={false}` to `InlineToast` when a containing live region combines
the receipt with other feedback. `AskUserFormCard` uses this for one announcement
of branch reveals, hidden nodes, answers set aside and the remaining count.

## Voice surface

One mic and one field cover dictation and live conversation (#3692). The
components only present; the consumer maps its own dictation or conversation
state onto them and owns every timer, permission and connection.

- `VoiceField` is the surface that replaces the composer. `compact` keeps the
composer's 52px at rest and one fixed 84px while a state label shows (D3–D5).
`tall` is one fixed 136px for live states L1–L8. `card` grows to its content,
for the Start card and notices.
- `tone` picks from one colour language: `you` (amber, you and your mic),
`brain` (teal, brain and its voice), `idle` (grey, nothing is heard) and
`fail` (red, only End and failures). `VOICE_SKINS` names the
`--bk-voice-*` tokens behind it.
- `meter` shows the `level` prop (0–1) as bars, a `sweep` (thinking/working), a
`flat` line (muted) or a paused `hatch` (reconnecting). The words and the
state label sit on the field's opaque ground, so the meter never lowers text
contrast.
- `MicButton` draws `idle`, `pressed`, `holding` (the ring from `progress`) and
`complete`, plus the "Keep holding to talk live" hint. It hands every pointer
and key event to the caller, which owns the hold threshold. `onTalkLive` adds
a "Talk live…" button that stays out of sight until it takes keyboard focus.
- `VoiceControlButton` is a raised 44px round control with pressed (solid),
disabled and busy forms. `tone="end"` is the only red one.
- `VoiceNotice` is a card with an icon, a title, one line and at most two
actions.
- `StartCard` holds the disclosure line, "What's shared", the Service row (with
Change only when `onChangeService` is passed), the persona radio group, the
`warn`/`block`/`error` notices and one Start button. A `block` or `error`
notice, or `service={null}`, leaves Start `aria-disabled`.
- `SpokenTurn`, `SpokenMark`, `UncertainWord`, `UnplayedText`, `CutOffTag`,
`VoiceToolChip` and `ConversationEndDivider` are the chat's spoken-turn marks.
A typed or legacy turn stays a plain `MessageBubble`.

`motion="reduce"` (or an ancestor with `data-motion="reduce"`) forces the
static form that `prefers-reduced-motion: reduce` produces: a still level line,
a flat tint for the sweep, a solid cursor, no turning icons, a ring without
easing and instant shape changes. Every state keeps its icon and its word.
Stories live under `Voice/` and `Screens/Voice`. Per-state baselines are in
`tests/visual/voice.visual.tsx`.

## Dictating composer state

`Composer` accepts `state="dictating"` to preserve a read-only draft and
Expand Down
Loading
Loading