@sixb/app 0.1.14 → 0.1.16

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.
Files changed (167) hide show
  1. package/dist/agent/agent-chat.d.ts +8 -1
  2. package/dist/agent/agent-chat.d.ts.map +1 -1
  3. package/dist/agent/agent-panel.d.ts +8 -1
  4. package/dist/agent/agent-panel.d.ts.map +1 -1
  5. package/dist/agent/agent-surface.d.ts +8 -1
  6. package/dist/agent/agent-surface.d.ts.map +1 -1
  7. package/dist/agent/approvals.d.ts +1 -4
  8. package/dist/agent/approvals.d.ts.map +1 -1
  9. package/dist/agent/artifact-panel.d.ts +21 -2
  10. package/dist/agent/artifact-panel.d.ts.map +1 -1
  11. package/dist/agent/components/activity-status.d.ts +1 -1
  12. package/dist/agent/components/activity-status.d.ts.map +1 -1
  13. package/dist/agent/components/agent-threads.d.ts +15 -0
  14. package/dist/agent/components/agent-threads.d.ts.map +1 -0
  15. package/dist/agent/components/approval-card.d.ts +4 -4
  16. package/dist/agent/components/approval-card.d.ts.map +1 -1
  17. package/dist/agent/components/approval-mode-chip.d.ts +4 -6
  18. package/dist/agent/components/approval-mode-chip.d.ts.map +1 -1
  19. package/dist/agent/components/auto-model-chip.d.ts +2 -3
  20. package/dist/agent/components/auto-model-chip.d.ts.map +1 -1
  21. package/dist/agent/components/composer-menu.d.ts +42 -0
  22. package/dist/agent/components/composer-menu.d.ts.map +1 -0
  23. package/dist/agent/components/composer.d.ts +8 -5
  24. package/dist/agent/components/composer.d.ts.map +1 -1
  25. package/dist/agent/components/conversation-panel.d.ts +3 -12
  26. package/dist/agent/components/conversation-panel.d.ts.map +1 -1
  27. package/dist/agent/components/dictation-bar.d.ts +13 -0
  28. package/dist/agent/components/dictation-bar.d.ts.map +1 -0
  29. package/dist/agent/components/message-parts.d.ts.map +1 -1
  30. package/dist/agent/components/message-view.d.ts +3 -1
  31. package/dist/agent/components/message-view.d.ts.map +1 -1
  32. package/dist/agent/components/model-controls.d.ts +15 -0
  33. package/dist/agent/components/model-controls.d.ts.map +1 -1
  34. package/dist/agent/components/model-picker-row.d.ts +9 -2
  35. package/dist/agent/components/model-picker-row.d.ts.map +1 -1
  36. package/dist/agent/components/participant-input.d.ts +7 -6
  37. package/dist/agent/components/participant-input.d.ts.map +1 -1
  38. package/dist/agent/components/thread-people.d.ts +4 -4
  39. package/dist/agent/components/thread-people.d.ts.map +1 -1
  40. package/dist/agent/components/threads-button.d.ts +14 -0
  41. package/dist/agent/components/threads-button.d.ts.map +1 -0
  42. package/dist/agent/conversation.d.ts +3 -1
  43. package/dist/agent/conversation.d.ts.map +1 -1
  44. package/dist/agent/delegation/child-card.d.ts +24 -11
  45. package/dist/agent/delegation/child-card.d.ts.map +1 -1
  46. package/dist/agent/delegation/child-cards.d.ts +2 -2
  47. package/dist/agent/delegation/child-cards.d.ts.map +1 -1
  48. package/dist/agent/delegation/child-group.d.ts +5 -4
  49. package/dist/agent/delegation/child-group.d.ts.map +1 -1
  50. package/dist/agent/delegation/child-parts.d.ts +17 -18
  51. package/dist/agent/delegation/child-parts.d.ts.map +1 -1
  52. package/dist/agent/delegation/child-work.d.ts +0 -13
  53. package/dist/agent/delegation/child-work.d.ts.map +1 -1
  54. package/dist/agent/delegation/interpret.d.ts +0 -5
  55. package/dist/agent/delegation/interpret.d.ts.map +1 -1
  56. package/dist/agent/delegation/model.d.ts +12 -6
  57. package/dist/agent/delegation/model.d.ts.map +1 -1
  58. package/dist/agent/dictation.d.ts +16 -0
  59. package/dist/agent/dictation.d.ts.map +1 -0
  60. package/dist/agent/hooks/use-agent-conversation.d.ts +3 -270
  61. package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
  62. package/dist/agent/hooks/use-people-suggestions.d.ts +21 -0
  63. package/dist/agent/hooks/use-people-suggestions.d.ts.map +1 -0
  64. package/dist/agent/hooks/use-thread-lists.d.ts +220 -0
  65. package/dist/agent/hooks/use-thread-lists.d.ts.map +1 -0
  66. package/dist/agent/i18n/en.d.ts +47 -36
  67. package/dist/agent/i18n/en.d.ts.map +1 -1
  68. package/dist/agent/i18n/fr.d.ts.map +1 -1
  69. package/dist/agent/i18n/index.d.ts +84 -72
  70. package/dist/agent/i18n/index.d.ts.map +1 -1
  71. package/dist/agent/react-router.d.ts +9 -0
  72. package/dist/agent/react-router.d.ts.map +1 -1
  73. package/dist/agent/run-presentation.d.ts +4 -1
  74. package/dist/agent/run-presentation.d.ts.map +1 -1
  75. package/dist/agent/thread-navigation.d.ts +8 -0
  76. package/dist/agent/thread-navigation.d.ts.map +1 -1
  77. package/dist/agent/thread-pages.d.ts +11 -0
  78. package/dist/agent/thread-pages.d.ts.map +1 -0
  79. package/dist/artifacts/person-avatar.d.ts +2 -2
  80. package/dist/{chunk-aes17xmx.js → chunk-12v6y89k.js} +4180 -3793
  81. package/dist/{chunk-aes17xmx.js.map → chunk-12v6y89k.js.map} +48 -42
  82. package/dist/{chunk-0yb22w6m.js → chunk-2a69ge8h.js} +1 -1
  83. package/dist/{chunk-vtp6nk44.js → chunk-bpj9mg5c.js} +1 -1
  84. package/dist/{chunk-1rhht9y0.js → chunk-hzy2g13h.js} +1 -1
  85. package/dist/createCustomApp.d.ts.map +1 -1
  86. package/dist/index.d.ts +2 -1
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +19 -6
  89. package/dist/index.js.map +6 -6
  90. package/dist/pages/home.d.ts.map +1 -1
  91. package/dist/pages/observability/ai-usage/calls.d.ts.map +1 -1
  92. package/dist/pages/settings/memory-history.d.ts.map +1 -1
  93. package/dist/pages/settings/messages.d.ts.map +1 -1
  94. package/dist/pages/values.d.ts +5 -0
  95. package/dist/pages/values.d.ts.map +1 -1
  96. package/dist/pages.d.ts +1 -1
  97. package/dist/pages.d.ts.map +1 -1
  98. package/dist/pages.js +60 -44
  99. package/dist/pages.js.map +8 -8
  100. package/dist/server.js +12 -6
  101. package/dist/server.js.map +3 -3
  102. package/dist/shell/agent-dock.d.ts.map +1 -1
  103. package/package.json +4 -4
  104. package/src/agent/agent-chat.tsx +15 -23
  105. package/src/agent/agent-panel.tsx +11 -0
  106. package/src/agent/agent-surface.tsx +11 -0
  107. package/src/agent/agent.css +33 -3
  108. package/src/agent/approvals.ts +4 -5
  109. package/src/agent/artifact-panel.tsx +113 -37
  110. package/src/agent/components/activity-status.tsx +1 -1
  111. package/src/agent/components/agent-threads.tsx +377 -0
  112. package/src/agent/components/approval-card.tsx +336 -327
  113. package/src/agent/components/approval-mode-chip.tsx +38 -145
  114. package/src/agent/components/auto-model-chip.tsx +103 -167
  115. package/src/agent/components/composer-menu.tsx +185 -0
  116. package/src/agent/components/composer.tsx +168 -103
  117. package/src/agent/components/context-chips.tsx +1 -1
  118. package/src/agent/components/conversation-panel.tsx +16 -36
  119. package/src/agent/components/dictation-bar.tsx +110 -0
  120. package/src/agent/components/file-attachment-card.tsx +5 -2
  121. package/src/agent/components/message-parts.tsx +27 -11
  122. package/src/agent/components/message-view.tsx +182 -68
  123. package/src/agent/components/model-controls.tsx +133 -125
  124. package/src/agent/components/model-picker-row.tsx +38 -17
  125. package/src/agent/components/participant-input.tsx +159 -31
  126. package/src/agent/components/reasoning-effort-slider.tsx +27 -27
  127. package/src/agent/components/shared-thread-notice.tsx +1 -1
  128. package/src/agent/components/thread-people.tsx +45 -15
  129. package/src/agent/components/threads-button.tsx +70 -0
  130. package/src/agent/components/transcript.tsx +30 -1
  131. package/src/agent/conversation.ts +25 -1
  132. package/src/agent/delegation/child-card.tsx +187 -247
  133. package/src/agent/delegation/child-cards.tsx +4 -7
  134. package/src/agent/delegation/child-group.tsx +179 -98
  135. package/src/agent/delegation/child-parts.tsx +71 -106
  136. package/src/agent/delegation/child-work.tsx +6 -52
  137. package/src/agent/delegation/interpret.ts +0 -28
  138. package/src/agent/delegation/model.ts +115 -39
  139. package/src/agent/dictation.ts +48 -0
  140. package/src/agent/hooks/use-agent-conversation.ts +10 -92
  141. package/src/agent/hooks/use-people-suggestions.ts +90 -0
  142. package/src/agent/hooks/use-thread-lists.ts +77 -0
  143. package/src/agent/i18n/en.ts +100 -83
  144. package/src/agent/i18n/fr.ts +109 -100
  145. package/src/agent/react-router.tsx +48 -5
  146. package/src/agent/run-presentation.ts +6 -2
  147. package/src/agent/thread-navigation.ts +16 -0
  148. package/src/agent/thread-pages.ts +24 -0
  149. package/src/artifacts/person-avatar.tsx +1 -1
  150. package/src/createCustomApp.ts +13 -6
  151. package/src/index.ts +7 -3
  152. package/src/pages/home.tsx +3 -1
  153. package/src/pages/observability/ai-usage/calls.tsx +2 -1
  154. package/src/pages/settings/memory-history.tsx +2 -1
  155. package/src/pages/settings/messages.ts +2 -3
  156. package/src/pages/values.tsx +23 -1
  157. package/src/pages.ts +5 -1
  158. package/src/shell/agent-dock.tsx +4 -2
  159. package/dist/agent/agents-page.d.ts +0 -4
  160. package/dist/agent/agents-page.d.ts.map +0 -1
  161. package/dist/agent/components/agent-thread-switcher.d.ts +0 -37
  162. package/dist/agent/components/agent-thread-switcher.d.ts.map +0 -1
  163. package/src/agent/agents-page.ts +0 -7
  164. package/src/agent/components/agent-thread-switcher.tsx +0 -519
  165. /package/dist/{chunk-0yb22w6m.js.map → chunk-2a69ge8h.js.map} +0 -0
  166. /package/dist/{chunk-vtp6nk44.js.map → chunk-bpj9mg5c.js.map} +0 -0
  167. /package/dist/{chunk-1rhht9y0.js.map → chunk-hzy2g13h.js.map} +0 -0
@@ -0,0 +1,185 @@
1
+ import {
2
+ Drawer,
3
+ DrawerContent,
4
+ DrawerDescription,
5
+ DrawerTitle,
6
+ DrawerTrigger,
7
+ Popover,
8
+ PopoverContent,
9
+ PopoverTrigger,
10
+ } from "@sixb/ui/components"
11
+ import { useIsMobile } from "@sixb/ui/hooks"
12
+ import { cn } from "@sixb/ui/lib/utils"
13
+ import { Check } from "lucide-react"
14
+ import { type ReactNode, useEffect, useRef } from "react"
15
+
16
+ /**
17
+ * The anatomy the composer's menus share (permissions, model, Auto): rows of an icon, a title and
18
+ * a line of description, the choice in medium weight with its check at the trailing edge.
19
+ */
20
+ const COMPOSER_MENU_CLASS_NAME =
21
+ "w-[19rem] max-w-[calc(100vw-1rem)] overflow-hidden rounded-[18px] border-black/[0.06] p-0 shadow-[0_18px_50px_-18px_rgb(0_0_0/0.28),0_2px_8px_-2px_rgb(0_0_0/0.06)] dark:border-white/[0.08] dark:shadow-[0_18px_50px_-18px_rgb(0_0_0/0.8)]"
22
+
23
+ export const COMPOSER_MENU_ROW_CLASS_NAME =
24
+ "flex w-full min-w-0 items-center gap-3 rounded-[10px] px-3 py-2 text-left outline-none transition-colors duration-100 hover:bg-black/[0.045] focus-visible:bg-black/[0.045] disabled:opacity-50 dark:hover:bg-white/[0.07] dark:focus-visible:bg-white/[0.07]"
25
+
26
+ /** A composer control that opens one of these menus: quiet medium text, filled while open. */
27
+ export const COMPOSER_TRIGGER_CLASS_NAME = cn(
28
+ "flex h-8 min-w-0 items-center gap-1.5 rounded-full px-2.5 text-xs font-medium text-muted-foreground outline-none transition-colors",
29
+ "hover:bg-muted hover:text-foreground focus-visible:bg-muted focus-visible:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40",
30
+ "disabled:cursor-default disabled:opacity-60 aria-expanded:bg-muted/60 aria-expanded:text-foreground"
31
+ )
32
+
33
+ /** The chosen row's resting highlight, as when the pointer is over it. */
34
+ export const COMPOSER_MENU_ROW_SELECTED_CLASS_NAME = "bg-black/[0.045] dark:bg-white/[0.07]"
35
+
36
+ /** The thinking slider's section under a model menu's list. */
37
+ export const COMPOSER_MENU_SECTION_CLASS_NAME =
38
+ "shrink-0 border-t border-black/[0.06] px-4 pt-3 pb-3.5 dark:border-white/[0.07]"
39
+
40
+ export function ComposerMenuHeader({ children }: { readonly children: ReactNode }) {
41
+ return <div className="px-2.5 pt-1.5 pb-1 text-xs text-muted-foreground">{children}</div>
42
+ }
43
+
44
+ /** A row's title, the choice in medium weight, over a line that says what it does. */
45
+ export function ComposerMenuRowText({
46
+ title,
47
+ description,
48
+ descriptionId,
49
+ selected = false,
50
+ }: {
51
+ readonly title: string
52
+ readonly description: string
53
+ readonly descriptionId: string
54
+ readonly selected: boolean
55
+ }) {
56
+ return (
57
+ <span className="min-w-0 flex-1">
58
+ <span
59
+ className={cn(
60
+ "block break-words text-[13.5px] tracking-[-0.005em] text-foreground",
61
+ selected && "font-medium"
62
+ )}
63
+ >
64
+ {title}
65
+ </span>
66
+ <span id={descriptionId} className="block text-xs leading-snug text-muted-foreground">
67
+ {description}
68
+ </span>
69
+ </span>
70
+ )
71
+ }
72
+
73
+ export function ComposerMenuCheck({ checked }: { readonly checked: boolean }) {
74
+ return (
75
+ <span className="flex size-4 shrink-0 items-center justify-center">
76
+ {checked ? (
77
+ <Check className="size-4 text-foreground" strokeWidth={2.2} aria-hidden="true" />
78
+ ) : null}
79
+ </span>
80
+ )
81
+ }
82
+
83
+ export function ComposerMenuDivider() {
84
+ return <div className="mx-2.5 my-1 h-px bg-border/70" />
85
+ }
86
+
87
+ /**
88
+ * A composer menu above its trigger, or a bottom sheet on a phone. `trigger` is the button that
89
+ * opens it.
90
+ */
91
+ export function ComposerMenu({
92
+ open,
93
+ onOpenChange,
94
+ trigger,
95
+ title,
96
+ align,
97
+ className,
98
+ children,
99
+ }: {
100
+ readonly open: boolean
101
+ readonly onOpenChange: (open: boolean) => void
102
+ readonly trigger: ReactNode
103
+ /** Names the menu to assistive technology. */
104
+ readonly title: string
105
+ readonly align: "start" | "end"
106
+ readonly className?: string
107
+ readonly children: ReactNode
108
+ }) {
109
+ const mobile = useIsMobile()
110
+
111
+ if (mobile) {
112
+ return (
113
+ <Drawer open={open} onOpenChange={onOpenChange}>
114
+ <DrawerTrigger asChild>{trigger}</DrawerTrigger>
115
+ <DrawerContent className="max-h-[85dvh]">
116
+ <DrawerTitle className="sr-only">{title}</DrawerTitle>
117
+ <DrawerDescription className="sr-only">{title}</DrawerDescription>
118
+ <div className="flex min-h-0 flex-col px-2 pt-1 pb-[max(0.75rem,env(safe-area-inset-bottom))]">
119
+ {children}
120
+ </div>
121
+ </DrawerContent>
122
+ </Drawer>
123
+ )
124
+ }
125
+
126
+ return (
127
+ <Popover open={open} onOpenChange={onOpenChange}>
128
+ <PopoverTrigger asChild>{trigger}</PopoverTrigger>
129
+ <PopoverContent
130
+ align={align}
131
+ side="top"
132
+ sideOffset={10}
133
+ collisionPadding={12}
134
+ aria-label={title}
135
+ // Capped by the viewport, not Radix's available-height variable: a size that depends on a
136
+ // value Radix rewrites loops its resize observer.
137
+ className={cn(
138
+ COMPOSER_MENU_CLASS_NAME,
139
+ "flex max-h-[min(32rem,calc(100dvh-8rem))] flex-col",
140
+ className
141
+ )}
142
+ >
143
+ {children}
144
+ </PopoverContent>
145
+ </Popover>
146
+ )
147
+ }
148
+
149
+ /**
150
+ * A menu's scrolling list, fading out at the bottom while more is below, so a cut-off row reads as
151
+ * "more" rather than broken.
152
+ */
153
+ export function ComposerMenuScroll({ className, children, ...props }: React.ComponentProps<"div">) {
154
+ const ref = useRef<HTMLDivElement>(null)
155
+
156
+ useEffect(() => {
157
+ const element = ref.current
158
+ if (!element) return
159
+ const update = () => {
160
+ const more = element.scrollTop + element.clientHeight < element.scrollHeight - 2
161
+ element.toggleAttribute("data-more", more)
162
+ }
163
+ update()
164
+ const observer = new ResizeObserver(update)
165
+ observer.observe(element)
166
+ element.addEventListener("scroll", update, { passive: true })
167
+ return () => {
168
+ observer.disconnect()
169
+ element.removeEventListener("scroll", update)
170
+ }
171
+ }, [])
172
+
173
+ return (
174
+ <div
175
+ ref={ref}
176
+ {...props}
177
+ className={cn(
178
+ "scrollbar-thin min-h-0 overflow-y-auto data-[more]:[mask-image:linear-gradient(to_bottom,black_calc(100%-2rem),transparent)]",
179
+ className
180
+ )}
181
+ >
182
+ {children}
183
+ </div>
184
+ )
185
+ }
@@ -8,7 +8,16 @@ import {
8
8
  MAX_AGENT_CONTEXT_LABEL_LENGTH,
9
9
  } from "@sixb/core/agents/context"
10
10
  import type { ModelReasoningLevel } from "@sixb/core/models"
11
- import { Marker, MarkerContent, MarkerIcon, Spinner, Textarea } from "@sixb/ui/components"
11
+ import {
12
+ DictationButton,
13
+ Marker,
14
+ MarkerContent,
15
+ MarkerIcon,
16
+ Spinner,
17
+ Textarea,
18
+ } from "@sixb/ui/components"
19
+ import { useDictation } from "@sixb/ui/hooks"
20
+ import type { SpeechRecognizer } from "@sixb/ui/lib/speech"
12
21
  import { cn } from "@sixb/ui/lib/utils"
13
22
  import { useQuery } from "@tanstack/react-query"
14
23
  import {
@@ -46,6 +55,7 @@ import {
46
55
  import { ApprovalModeChip } from "./approval-mode-chip"
47
56
  import { ContextChips } from "./context-chips"
48
57
  import { ContextPicker } from "./context-picker"
58
+ import { DictationBar } from "./dictation-bar"
49
59
  import { ModelControls } from "./model-controls"
50
60
 
51
61
  export interface ComposerProps {
@@ -101,15 +111,17 @@ export interface ComposerProps {
101
111
  /**
102
112
  * What the agent may change without asking in the reader's next turns. With
103
113
  * {@link onApprovalModeChange}, the composer shows it as a chip, and Shift+Tab in an empty input
104
- * switches between Manual and Accept edits.
114
+ * cycles through the modes.
105
115
  */
106
116
  readonly approvalMode?: AgentApprovalMode
107
- /** The reader's mode for new conversations, which the chip's menu offers to change. */
108
- readonly defaultApprovalMode?: AgentApprovalMode
109
117
  readonly onApprovalModeChange?: (mode: AgentApprovalMode) => void
110
- readonly onMakeApprovalModeDefault?: (mode: AgentApprovalMode) => void
111
118
  /** A turn waits for the reader's approval: the input says how to answer it or move on. */
112
119
  readonly awaitingApproval?: boolean
120
+ /**
121
+ * Dictate the message: a microphone records it, and the transcript lands at the end of the
122
+ * input. Omit for no microphone.
123
+ */
124
+ readonly dictation?: SpeechRecognizer
113
125
  }
114
126
 
115
127
  type ComposerAttachment =
@@ -135,6 +147,13 @@ type ComposerAttachment =
135
147
 
136
148
  const MAX_HEIGHT_PX = 200
137
149
 
150
+ // Send and stop: the one filled control in the box.
151
+ const SEND_BUTTON_CLASS_NAME = cn(
152
+ "flex size-8 shrink-0 items-center justify-center rounded-full outline-none transition-colors",
153
+ "bg-foreground text-background hover:bg-foreground/85 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-offset-2 focus-visible:ring-offset-card",
154
+ "disabled:bg-foreground/25 disabled:text-background dark:disabled:bg-white/20 dark:disabled:text-white/70"
155
+ )
156
+
138
157
  export function composerCanFocus({
139
158
  disabled,
140
159
  pending,
@@ -172,10 +191,9 @@ export function Composer({
172
191
  ambientContext = [],
173
192
  compact = false,
174
193
  approvalMode,
175
- defaultApprovalMode,
176
194
  onApprovalModeChange,
177
- onMakeApprovalModeDefault,
178
195
  awaitingApproval = false,
196
+ dictation,
179
197
  }: ComposerProps) {
180
198
  const agentMessages = useAgentMessages()
181
199
  const messages = agentMessages.composer
@@ -196,6 +214,17 @@ export function Composer({
196
214
  const fileInputRef = useRef<HTMLInputElement>(null)
197
215
  const dragDepthRef = useRef(0)
198
216
  const uploadFile = useUploadFile()
217
+ // The transcript is appended to the text as it was when dictation started, so the input stays
218
+ // read-only until it lands. Recording ends only when the reader stops it: no restarts. A
219
+ // composer disabled meanwhile, by someone else's turn, only keeps a new dictation from starting.
220
+ const voice = useDictation({
221
+ value,
222
+ onChange: setValue,
223
+ recognizer: dictation,
224
+ disabled: !dictation,
225
+ autoRestart: false,
226
+ })
227
+ const wasDictatingRef = useRef(false)
199
228
  const wasRunningRef = useRef(Boolean(running))
200
229
  const dismissedAmbientRef = useRef(new Set<string>())
201
230
  const ambientKey = JSON.stringify(ambientContext.map(agentContextFingerprint))
@@ -240,6 +269,7 @@ export function Composer({
240
269
  !pending &&
241
270
  !running &&
242
271
  !uploading &&
272
+ !voice.isActive &&
243
273
  failedCount === 0
244
274
 
245
275
  // Reconcile page context by canonical identity. A removed ambient chip stays removed for the
@@ -291,6 +321,17 @@ export function Composer({
291
321
  textareaRef.current?.focus()
292
322
  }, [draftNonce])
293
323
 
324
+ // However a dictation ends, the focus returns to the input, the caret after any transcript.
325
+ useEffect(() => {
326
+ const wasDictating = wasDictatingRef.current
327
+ wasDictatingRef.current = voice.isActive
328
+ const input = textareaRef.current
329
+ if (!wasDictating || voice.isActive || !input) return
330
+
331
+ input.focus()
332
+ input.setSelectionRange(input.value.length, input.value.length)
333
+ }, [voice.isActive])
334
+
294
335
  useEffect(() => {
295
336
  const wasRunning = wasRunningRef.current
296
337
  wasRunningRef.current = Boolean(running)
@@ -333,6 +374,7 @@ export function Composer({
333
374
  if (!canSend) return
334
375
  onSend(value.trim(), readyAttachments, contextEntries)
335
376
  setValue("")
377
+ voice.reset()
336
378
  setAttachments([])
337
379
  dismissedAmbientRef.current.clear()
338
380
  setContextEntries(ambientContext.map((context) => ({ context, origin: "ambient" })))
@@ -536,10 +578,17 @@ export function Composer({
536
578
  }
537
579
 
538
580
  // Enter sends; Cmd/Ctrl+Enter and Shift+Enter insert a newline (and let the field grow).
539
- // Shift+Tab in an empty input switches between Manual and Accept edits, as in a terminal agent.
540
- // Once something is typed, it moves focus back as everywhere else, and Auto is only ever chosen
541
- // from the chip's menu.
581
+ // Shift+Tab in an empty input cycles Manual, Accept edits and Auto, as in a terminal agent. Once
582
+ // something is typed, it moves focus back as everywhere else.
542
583
  const handleKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {
584
+ // While dictating, Enter finishes and Escape cancels from the input too, as from the bar.
585
+ if (voice.isActive) {
586
+ if (event.key === "Enter") voice.stop()
587
+ else if (event.key === "Escape") voice.abort()
588
+ else return
589
+ event.preventDefault()
590
+ return
591
+ }
543
592
  if (
544
593
  event.key === "Tab" &&
545
594
  event.shiftKey &&
@@ -609,7 +658,10 @@ export function Composer({
609
658
  ? messages.uploadingAttachment
610
659
  : failedCount > 0
611
660
  ? messages.attachmentsFailed(failedCount)
612
- : hint
661
+ : (voice.error ?? hint)
662
+ const statusIsError = !uploading && (failedCount > 0 || voice.error !== null)
663
+
664
+ const showPermissions = approvalMode !== undefined && onApprovalModeChange !== undefined
613
665
 
614
666
  return (
615
667
  <div ref={rootRef} className={cn("relative bg-background px-4 pt-2 pb-3", className)}>
@@ -620,7 +672,7 @@ export function Composer({
620
672
  <DropFilesOverlay compact={compact} />
621
673
  )
622
674
  ) : null}
623
- <div className="mx-auto w-full max-w-2xl">
675
+ <div className="mx-auto w-full max-w-[46rem]">
624
676
  {error ? (
625
677
  <Marker role="alert" className="mb-2 items-start text-destructive">
626
678
  <MarkerIcon>
@@ -630,10 +682,8 @@ export function Composer({
630
682
  </Marker>
631
683
  ) : null}
632
684
  <div
633
- className={cn(
634
- "relative rounded-3xl border border-border bg-card shadow-sm transition-[border-color,box-shadow] duration-500",
635
- draggingFiles && "border-primary/50 ring-2 ring-primary/15"
636
- )}
685
+ data-dragging={draggingFiles || undefined}
686
+ className="sixb-composer-surface relative rounded-3xl bg-card"
637
687
  >
638
688
  <ContextPicker
639
689
  open={mention !== null}
@@ -660,13 +710,19 @@ export function Composer({
660
710
  ))}
661
711
  </div>
662
712
  ) : null}
663
- <div className="px-4 pt-2.5 pb-1">
713
+ <div
714
+ className={cn(
715
+ "px-4 pb-1",
716
+ contextEntries.length > 0 || attachments.length > 0 ? "pt-1" : "pt-3.5"
717
+ )}
718
+ >
664
719
  <Textarea
665
720
  ref={textareaRef}
666
721
  autoFocus={composerCanFocus({ disabled, pending, running })}
667
722
  value={value}
668
723
  onChange={(event) => {
669
724
  setValue(event.target.value)
725
+ if (voice.error) voice.reset()
670
726
  setDismissedMention(null)
671
727
  updateMention(event.target.value, event.target.selectionStart)
672
728
  }}
@@ -675,99 +731,107 @@ export function Composer({
675
731
  }
676
732
  onKeyDown={handleKeyDown}
677
733
  disabled={disabled}
734
+ readOnly={voice.isActive}
678
735
  rows={1}
679
736
  placeholder={
680
- awaitingApproval
681
- ? agentMessages.approvals.composerPlaceholder
682
- : (placeholder ?? messages.placeholder)
737
+ voice.status === "stopping"
738
+ ? messages.dictationTranscribing
739
+ : voice.isActive
740
+ ? messages.dictationListening
741
+ : awaitingApproval
742
+ ? agentMessages.approvals.composerPlaceholder
743
+ : (placeholder ?? messages.placeholder)
683
744
  }
684
745
  aria-label={messages.message}
685
- className="max-h-[200px] min-h-9 w-full resize-none overflow-y-hidden border-0 bg-transparent px-0 py-1 text-[15px] leading-relaxed shadow-none focus-visible:ring-0 md:text-[15px]"
746
+ className="max-h-[200px] min-h-9 w-full resize-none overflow-y-hidden border-0 bg-transparent px-0 py-1 text-[15px] leading-relaxed shadow-none placeholder:text-muted-foreground/80 focus-visible:ring-0 md:text-[15px]"
686
747
  />
687
748
  </div>
688
- <div className="relative flex min-w-0 items-center gap-1 px-2.5 pb-2">
689
- <input
690
- ref={fileInputRef}
691
- type="file"
692
- multiple
693
- className="sr-only"
694
- onChange={(event) => handleFilesSelected(event.target.files)}
695
- disabled={!canAttachFiles}
696
- aria-hidden="true"
697
- />
698
- <button
699
- type="button"
700
- onClick={() => fileInputRef.current?.click()}
701
- disabled={!canAttachFiles}
702
- aria-label={messages.attachFiles}
703
- className={cn(
704
- "flex size-9 shrink-0 items-center justify-center rounded-full text-foreground transition-colors",
705
- "hover:bg-muted disabled:cursor-not-allowed disabled:text-muted-foreground"
706
- )}
707
- >
708
- <Plus className="size-5" />
709
- </button>
710
- {approvalMode !== undefined && onApprovalModeChange ? (
711
- <ApprovalModeChip
712
- mode={approvalMode}
713
- defaultMode={defaultApprovalMode}
714
- onChange={changeApprovalMode}
715
- onMakeDefault={onMakeApprovalModeDefault}
716
- />
717
- ) : null}
718
- <span className="min-w-0 flex-1" />
719
- {onSelectModel && onSelectReasoning ? (
720
- <ModelControls
721
- models={models}
722
- selectedModel={selectedModel}
723
- selectedReasoning={selectedReasoning}
724
- loading={modelsLoading}
725
- error={modelsError}
726
- disabled={disabled || pending || running}
727
- onSelectModel={onSelectModel}
728
- onSelectReasoning={onSelectReasoning}
729
- onResetReasoning={onResetReasoning}
730
- usingDefault={usingDefaultModel}
731
- onResetToDefault={onResetModelSelection}
732
- routing={modelRouting}
733
- />
734
- ) : null}
735
- {running && onStop ? (
736
- <button
737
- type="button"
738
- onClick={onStop}
739
- disabled={stopping}
740
- aria-label={messages.stop}
741
- className={cn(
742
- "flex size-9 shrink-0 items-center justify-center rounded-full transition-colors",
743
- "bg-primary text-primary-foreground hover:bg-primary/90",
744
- "disabled:bg-muted disabled:text-muted-foreground"
745
- )}
746
- >
747
- {stopping ? (
748
- <Spinner className="size-4" />
749
- ) : (
750
- <Square className="size-3.5 fill-current" />
751
- )}
752
- </button>
749
+ <div className="relative flex min-w-0 items-center gap-0.5 px-2 pb-2">
750
+ {voice.isActive ? (
751
+ <DictationBar dictation={voice} doneClassName={SEND_BUTTON_CLASS_NAME} />
753
752
  ) : (
754
- <button
755
- type="button"
756
- onClick={submit}
757
- disabled={!canSend}
758
- aria-label={messages.send}
759
- className={cn(
760
- "flex size-9 shrink-0 items-center justify-center rounded-full transition-colors",
761
- "bg-primary text-primary-foreground hover:bg-primary/90",
762
- "disabled:bg-muted disabled:text-muted-foreground"
763
- )}
764
- >
765
- {pending || uploading ? (
766
- <Spinner className="size-4" />
753
+ <>
754
+ <input
755
+ ref={fileInputRef}
756
+ type="file"
757
+ multiple
758
+ className="sr-only"
759
+ onChange={(event) => handleFilesSelected(event.target.files)}
760
+ disabled={!canAttachFiles}
761
+ aria-hidden="true"
762
+ />
763
+ <button
764
+ type="button"
765
+ onClick={() => fileInputRef.current?.click()}
766
+ disabled={!canAttachFiles}
767
+ aria-label={messages.attachFiles}
768
+ className={cn(
769
+ "flex size-8 shrink-0 items-center justify-center rounded-full text-muted-foreground outline-none transition-colors",
770
+ "hover:bg-muted hover:text-foreground focus-visible:bg-muted focus-visible:ring-2 focus-visible:ring-ring/40",
771
+ "disabled:cursor-not-allowed disabled:opacity-50"
772
+ )}
773
+ >
774
+ <Plus className="size-[18px]" strokeWidth={1.75} />
775
+ </button>
776
+ {showPermissions ? (
777
+ <ApprovalModeChip mode={approvalMode} onChange={changeApprovalMode} />
778
+ ) : null}
779
+ <span className="min-w-2 flex-1" />
780
+ {onSelectModel && onSelectReasoning ? (
781
+ <ModelControls
782
+ models={models}
783
+ selectedModel={selectedModel}
784
+ selectedReasoning={selectedReasoning}
785
+ loading={modelsLoading}
786
+ error={modelsError}
787
+ disabled={disabled || pending || running}
788
+ onSelectModel={onSelectModel}
789
+ onSelectReasoning={onSelectReasoning}
790
+ onResetReasoning={onResetReasoning}
791
+ usingDefault={usingDefaultModel}
792
+ onResetToDefault={onResetModelSelection}
793
+ routing={modelRouting}
794
+ />
795
+ ) : null}
796
+ {dictation ? (
797
+ <DictationButton
798
+ dictation={voice}
799
+ disabled={disabled}
800
+ variant="ghost"
801
+ size="icon-sm"
802
+ className="ml-1 bg-transparent text-muted-foreground shadow-none hover:text-foreground"
803
+ />
804
+ ) : null}
805
+ {running && onStop ? (
806
+ <button
807
+ type="button"
808
+ onClick={onStop}
809
+ disabled={stopping}
810
+ aria-label={messages.stop}
811
+ className={cn(SEND_BUTTON_CLASS_NAME, "ml-1")}
812
+ >
813
+ {stopping ? (
814
+ <Spinner className="size-3.5" />
815
+ ) : (
816
+ <Square className="size-2.5 fill-current" />
817
+ )}
818
+ </button>
767
819
  ) : (
768
- <ArrowUp className="size-[18px]" />
820
+ <button
821
+ type="button"
822
+ onClick={submit}
823
+ disabled={!canSend}
824
+ aria-label={messages.send}
825
+ className={cn(SEND_BUTTON_CLASS_NAME, "ml-1")}
826
+ >
827
+ {pending || uploading ? (
828
+ <Spinner className="size-3.5" />
829
+ ) : (
830
+ <ArrowUp className="size-4" strokeWidth={2.25} />
831
+ )}
832
+ </button>
769
833
  )}
770
- </button>
834
+ </>
771
835
  )}
772
836
  </div>
773
837
  </div>
@@ -777,9 +841,10 @@ export function Composer({
777
841
  {statusHint ? (
778
842
  <p
779
843
  className={cn(
780
- "mt-1.5 px-1 text-[11px] text-muted-foreground",
781
- failedCount > 0 && "text-destructive"
844
+ "mt-2 truncate px-4 text-xs text-muted-foreground",
845
+ statusIsError && "text-destructive"
782
846
  )}
847
+ title={statusHint}
783
848
  >
784
849
  {statusHint}
785
850
  </p>
@@ -40,7 +40,7 @@ function ContextChip({
40
40
  const messages = useAgentMessages().context
41
41
  const label = useAgentContextLabel(context)
42
42
  return (
43
- <span className="inline-flex max-w-[min(100%,20rem)] items-center gap-1.5 rounded-full border border-border bg-muted/70 py-1 pr-1.5 pl-2 text-xs text-foreground">
43
+ <span className="inline-flex max-w-[min(100%,20rem)] items-center gap-1.5 rounded-full bg-muted py-1 pr-1.5 pl-2 text-xs text-foreground">
44
44
  {context.kind === "object" ? (
45
45
  <Box className="size-3.5 shrink-0 text-muted-foreground" aria-hidden="true" />
46
46
  ) : (