@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
@@ -1,9 +1,11 @@
1
1
  import { cn } from "@sixb/ui/lib/utils"
2
- import { X } from "lucide-react"
2
+ import { Mail, X } from "lucide-react"
3
3
  import { type KeyboardEvent, type Ref, useId, useState } from "react"
4
+ import { PersonAvatar } from "../../artifacts/person-avatar"
5
+ import { type PersonSuggestion, usePeopleSuggestions } from "../hooks/use-people-suggestions"
4
6
  import { useAgentMessages } from "../i18n"
5
7
 
6
- /** Someone the owner picked to add: a member of the directory, or whoever an email names. */
8
+ /** Someone the owner picked to add: a member, or whoever an email names. */
7
9
  export type ParticipantChoice =
8
10
  | { readonly kind: "user"; readonly id: string; readonly displayName?: string }
9
11
  | { readonly kind: "email"; readonly email: string }
@@ -11,6 +13,8 @@ export type ParticipantChoice =
11
13
  export interface ParticipantInputProps {
12
14
  /** Who is picked so far, shown as chips inside the field. */
13
15
  readonly staged: readonly ParticipantChoice[]
16
+ /** User ids the list never suggests: the reader and whoever is in the thread already. */
17
+ readonly exclude: ReadonlySet<string>
14
18
  readonly onAdd: (choice: ParticipantChoice) => void
15
19
  readonly onRemove: (choice: ParticipantChoice) => void
16
20
  readonly disabled?: boolean
@@ -21,14 +25,19 @@ export interface ParticipantInputProps {
21
25
  const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
22
26
  const SEPARATORS = /[\s,;]+/
23
27
 
28
+ /** A row of the list: a suggested person, or the email as typed. */
29
+ type Option =
30
+ | { readonly kind: "person"; readonly person: PersonSuggestion }
31
+ | { readonly kind: "email"; readonly email: string }
32
+
24
33
  /**
25
- * How the owner names people to add, like an invite field: Enter, a comma or leaving the field
26
- * turns each valid email into a chip, a malformed one stays to be fixed, and Backspace in an empty
27
- * field takes the last chip back. Today an email, which the server resolves to an active member;
28
- * a member directory can take this place and emit `{ kind: "user" }` instead.
34
+ * Who to add, as in a mail client: typing lists the people it matches, by name, or by email too
35
+ * where the reader may read the member directory, and a full email can be added as typed. Up and
36
+ * down choose, Enter adds, Backspace in an empty field takes the last chip back.
29
37
  */
30
38
  export function ParticipantInput({
31
39
  staged,
40
+ exclude,
32
41
  onAdd,
33
42
  onRemove,
34
43
  disabled = false,
@@ -36,13 +45,43 @@ export function ParticipantInput({
36
45
  }: ParticipantInputProps) {
37
46
  const messages = useAgentMessages().sharing
38
47
  const id = useId()
48
+ const listId = `${id}-list`
39
49
  const errorId = `${id}-error`
40
- const hintId = `${id}-hint`
41
50
  const [text, setText] = useState("")
51
+ const [focused, setFocused] = useState(false)
42
52
  const [invalid, setInvalid] = useState(false)
53
+ // Nothing is chosen until the reader types or moves: a stray Enter adds no one.
54
+ const [active, setActive] = useState<number | null>(null)
55
+
56
+ const stagedIds = staged.flatMap((choice) => (choice.kind === "user" ? [choice.id] : []))
57
+ const { suggestions, canSearch } = usePeopleSuggestions({
58
+ text,
59
+ exclude: new Set([...exclude, ...stagedIds]),
60
+ })
61
+ const typed = text.trim()
62
+ const options: Option[] = [
63
+ ...suggestions.map((person) => ({ kind: "person" as const, person })),
64
+ ...(EMAIL.test(typed) &&
65
+ !suggestions.some((person) => person.email?.toLowerCase() === typed.toLowerCase())
66
+ ? [{ kind: "email" as const, email: typed }]
67
+ : []),
68
+ ]
69
+ const open = focused && !disabled && options.length > 0
70
+ const current = open && active !== null ? Math.min(active, options.length - 1) : -1
71
+
72
+ const choose = (option: Option) => {
73
+ onAdd(
74
+ option.kind === "person"
75
+ ? { kind: "user", id: option.person.id, displayName: option.person.name }
76
+ : { kind: "email", email: option.email }
77
+ )
78
+ setText("")
79
+ setInvalid(false)
80
+ setActive(null)
81
+ }
43
82
 
44
- // Every valid email becomes a chip; whatever is not one stays in the field, flagged.
45
- const commit = () => {
83
+ // Pasted or typed emails become chips; whatever is not one stays in the field, flagged.
84
+ const commitEmails = () => {
46
85
  const entries = text.split(SEPARATORS).filter(Boolean)
47
86
  if (entries.length === 0) return
48
87
 
@@ -50,15 +89,39 @@ export function ParticipantInput({
50
89
  for (const email of entries.filter((entry) => EMAIL.test(entry))) {
51
90
  onAdd({ kind: "email", email })
52
91
  }
53
-
54
92
  setText(rejected.join(" "))
55
93
  setInvalid(rejected.length > 0)
56
94
  }
57
95
 
58
96
  const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
59
- if (event.key === "Enter" || event.key === ",") {
97
+ if (open && (event.key === "ArrowDown" || event.key === "ArrowUp")) {
98
+ event.preventDefault()
99
+ const step = event.key === "ArrowDown" ? 1 : -1
100
+ setActive(
101
+ current < 0
102
+ ? step > 0
103
+ ? 0
104
+ : options.length - 1
105
+ : (current + step + options.length) % options.length
106
+ )
107
+ return
108
+ }
109
+ if (event.key === "Enter") {
60
110
  event.preventDefault()
61
- commit()
111
+ const option = options[current]
112
+ if (option) choose(option)
113
+ else commitEmails()
114
+ return
115
+ }
116
+ if (event.key === ",") {
117
+ event.preventDefault()
118
+ commitEmails()
119
+ return
120
+ }
121
+ // Escape closes the list first, and the dialog only after.
122
+ if (event.key === "Escape" && open) {
123
+ event.stopPropagation()
124
+ setFocused(false)
62
125
  return
63
126
  }
64
127
 
@@ -67,16 +130,16 @@ export function ParticipantInput({
67
130
  }
68
131
 
69
132
  return (
70
- <div className="flex flex-col gap-1.5">
133
+ <div className="flex flex-col">
71
134
  <label htmlFor={id} className="sr-only">
72
- {messages.email}
135
+ {messages.addLabel}
73
136
  </label>
74
137
 
75
138
  <div
76
139
  className={cn(
77
- "flex min-h-10 flex-wrap items-center gap-1.5 rounded-lg border border-input bg-card px-2 py-1.5 transition-colors",
78
- "focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/30",
79
- invalid && "border-destructive focus-within:border-destructive",
140
+ "flex min-h-11 flex-wrap items-center gap-1.5 rounded-xl bg-muted/60 px-2 py-1.5 transition-colors",
141
+ "focus-within:bg-muted",
142
+ invalid && "ring-1 ring-destructive",
80
143
  disabled && "opacity-60"
81
144
  )}
82
145
  >
@@ -96,35 +159,99 @@ export function ParticipantInput({
96
159
  <input
97
160
  ref={inputRef}
98
161
  id={id}
99
- type="email"
162
+ type="text"
163
+ inputMode="email"
164
+ role="combobox"
165
+ aria-expanded={open}
166
+ aria-controls={listId}
167
+ aria-autocomplete="list"
168
+ aria-activedescendant={current >= 0 ? `${listId}-${current}` : undefined}
100
169
  value={text}
101
170
  autoComplete="off"
171
+ spellCheck={false}
102
172
  enterKeyHint="done"
103
173
  placeholder={
104
- staged.length > 0 ? messages.emailPlaceholder : messages.emailPlaceholderEmpty
174
+ staged.length > 0
175
+ ? messages.addMore
176
+ : canSearch
177
+ ? messages.addPlaceholder
178
+ : messages.addByEmail
105
179
  }
106
180
  aria-invalid={invalid || undefined}
107
- aria-describedby={invalid ? errorId : hintId}
181
+ aria-describedby={invalid ? errorId : undefined}
108
182
  disabled={disabled}
109
183
  onChange={(event) => {
110
184
  setText(event.target.value)
111
185
  setInvalid(false)
186
+ setActive(event.target.value.trim() ? 0 : null)
112
187
  }}
113
188
  onKeyDown={onKeyDown}
114
- onBlur={commit}
115
- className="h-7 min-w-[10rem] flex-1 bg-transparent px-1 text-sm outline-none placeholder:text-muted-foreground"
189
+ onFocus={() => setFocused(true)}
190
+ onBlur={() => {
191
+ setFocused(false)
192
+ if (EMAIL.test(typed) || typed.includes(",")) commitEmails()
193
+ }}
194
+ className="h-8 min-w-[10rem] flex-1 bg-transparent px-1.5 text-sm outline-none placeholder:text-muted-foreground"
116
195
  />
117
196
  </div>
118
197
 
198
+ {/* The list opens in the flow under the field, so the dialog grows to hold it. */}
199
+ <ul
200
+ id={listId}
201
+ role="listbox"
202
+ aria-label={messages.suggestions}
203
+ className={cn("flex flex-col py-1", !open && "hidden")}
204
+ >
205
+ {open
206
+ ? options.map((option, index) => (
207
+ <li
208
+ key={option.kind === "person" ? option.person.id : `email:${option.email}`}
209
+ id={`${listId}-${index}`}
210
+ role="option"
211
+ aria-selected={index === current}
212
+ // Pressing keeps focus in the field, so the list stays open until the pick lands.
213
+ onMouseDown={(event) => event.preventDefault()}
214
+ onMouseEnter={() => setActive(index)}
215
+ onClick={() => choose(option)}
216
+ className={cn(
217
+ "flex min-h-12 cursor-default items-center gap-3 rounded-xl px-2 py-1.5 text-sm",
218
+ index === current && "bg-black/[0.045] dark:bg-white/[0.07]"
219
+ )}
220
+ >
221
+ {option.kind === "person" ? (
222
+ <>
223
+ <PersonAvatar name={option.person.name} size="md" />
224
+ <span className="min-w-0 flex-1">
225
+ <span className="block truncate font-medium text-foreground">
226
+ {option.person.name}
227
+ </span>
228
+ {option.person.email ? (
229
+ <span className="block truncate text-xs text-muted-foreground">
230
+ {option.person.email}
231
+ </span>
232
+ ) : null}
233
+ </span>
234
+ </>
235
+ ) : (
236
+ <>
237
+ <span className="grid size-8 shrink-0 place-items-center rounded-full bg-muted-foreground/15 text-foreground/70">
238
+ <Mail className="size-4" aria-hidden="true" />
239
+ </span>
240
+ <span className="min-w-0 truncate text-foreground">
241
+ {messages.addEmail(option.email)}
242
+ </span>
243
+ </>
244
+ )}
245
+ </li>
246
+ ))
247
+ : null}
248
+ </ul>
249
+
119
250
  {invalid ? (
120
- <p id={errorId} role="alert" className="px-1 text-xs text-destructive">
121
- {messages.invalidEmail}
122
- </p>
123
- ) : (
124
- <p id={hintId} className="px-1 text-xs text-muted-foreground">
125
- {messages.addHint}
251
+ <p id={errorId} role="alert" className="px-1 pt-1.5 text-xs text-destructive">
252
+ {canSearch ? messages.notFound : messages.invalidEmail}
126
253
  </p>
127
- )}
254
+ ) : null}
128
255
  </div>
129
256
  )
130
257
  }
@@ -141,14 +268,15 @@ function StagedChip({
141
268
  const messages = useAgentMessages().sharing
142
269
 
143
270
  return (
144
- <li className="flex h-7 max-w-full items-center gap-1 rounded-full bg-muted pr-1 pl-2.5 text-xs text-foreground">
271
+ <li className="flex h-7 max-w-full items-center gap-1.5 rounded-full bg-background pr-1 pl-1 text-xs font-medium text-foreground shadow-[0_0_0_1px_rgb(0_0_0/0.06)] dark:shadow-[0_0_0_1px_rgb(255_255_255/0.1)]">
272
+ <PersonAvatar name={label} size="xs" />
145
273
  <span className="min-w-0 truncate">{label}</span>
146
274
  <button
147
275
  type="button"
148
276
  aria-label={messages.unstage(label)}
149
277
  onClick={onRemove}
150
278
  disabled={disabled}
151
- className="grid size-5 shrink-0 place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:bg-background hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/30"
279
+ className="grid size-5 shrink-0 place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/30"
152
280
  >
153
281
  <X className="size-3" />
154
282
  </button>
@@ -35,34 +35,34 @@ export function ReasoningEffortSlider({
35
35
 
36
36
  return (
37
37
  <div>
38
- <div className="relative flex min-h-6 items-center justify-between gap-2 pr-8">
38
+ <div className="flex min-h-6 items-center gap-2">
39
39
  <span className="text-xs text-muted-foreground">{messages.thinking}</span>
40
- <div className="min-w-0 text-center">
41
- <span
42
- title={messages.descriptions[value]}
43
- className={cn(
44
- "text-sm font-medium",
45
- enhanced ? "text-[#007aff] dark:text-[#9ec3ee]" : "text-primary"
46
- )}
47
- >
48
- <span key={value} className="sixb-reasoning-label">
49
- {messages.levels[value]}
50
- </span>
51
- </span>
52
- </div>
53
- <button
54
- type="button"
55
- disabled={disabled || value === resetLevel}
56
- aria-label={messages.reset}
57
- title={messages.useDefault}
58
- onClick={() => {
59
- if (onReset) onReset()
60
- else if (resetLevel) onChange(resetLevel)
61
- }}
62
- className="absolute top-1/2 right-0 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground/60 outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40 disabled:opacity-40"
40
+ <span
41
+ title={messages.descriptions[value]}
42
+ className={cn(
43
+ "ml-auto text-xs font-medium",
44
+ enhanced ? "text-[#007aff] dark:text-[#9ec3ee]" : "text-foreground"
45
+ )}
63
46
  >
64
- <RotateCcw className="size-3.5" aria-hidden="true" />
65
- </button>
47
+ <span key={value} className="sixb-reasoning-label">
48
+ {messages.levels[value]}
49
+ </span>
50
+ </span>
51
+ {value === resetLevel ? null : (
52
+ <button
53
+ type="button"
54
+ disabled={disabled}
55
+ aria-label={messages.reset}
56
+ title={messages.useDefault}
57
+ onClick={() => {
58
+ if (onReset) onReset()
59
+ else if (resetLevel) onChange(resetLevel)
60
+ }}
61
+ className="-mr-1 flex size-6 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40"
62
+ >
63
+ <RotateCcw className="size-3.5" aria-hidden="true" />
64
+ </button>
65
+ )}
66
66
  </div>
67
67
  <div
68
68
  data-max={enhanced}
@@ -115,7 +115,7 @@ export function ReasoningEffortSlider({
115
115
  if (level) onChange(level)
116
116
  }
117
117
  }}
118
- className="sixb-reasoning-input focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-popover"
118
+ className="sixb-reasoning-input focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:ring-offset-2 focus-visible:ring-offset-popover"
119
119
  />
120
120
  </div>
121
121
  </div>
@@ -17,7 +17,7 @@ export function SharedThreadNotice({
17
17
  const messages = useAgentMessages().sharing
18
18
 
19
19
  return (
20
- <div className="mx-auto flex w-full max-w-3xl items-center gap-2 px-5 pt-1 text-xs text-muted-foreground">
20
+ <div className="mx-auto flex w-full max-w-3xl items-center gap-2 px-4 pt-1 text-xs text-muted-foreground">
21
21
  <PersonAvatar name={owner} size="xs" />
22
22
  <span className="min-w-0 truncate">{messages.sharedBy(owner)}</span>
23
23
  <span aria-hidden className="shrink-0">
@@ -26,7 +26,7 @@ import {
26
26
  } from "@sixb/ui/components"
27
27
  import { useIsMobile } from "@sixb/ui/hooks"
28
28
  import { cn } from "@sixb/ui/lib/utils"
29
- import { AlertTriangle, GitBranchPlus, LogOut, UserPlus, X } from "lucide-react"
29
+ import { Eye, GitBranchPlus, LogOut, UserPlus, X } from "lucide-react"
30
30
  import { type ReactNode, type RefObject, useId, useRef, useState } from "react"
31
31
  import { PersonAvatar } from "../../artifacts/person-avatar"
32
32
  import type { CurrentUser } from "../../session"
@@ -55,9 +55,9 @@ export interface ThreadPeopleProps {
55
55
  const STACKED = 3
56
56
 
57
57
  /**
58
- * Who takes part in a conversation, from its header: an avatar stack once it is shared, a share
59
- * button before. It opens a dialog, or a bottom drawer on a phone. The owner adds and removes
60
- * people; a participant sees who is there, leaves, or continues in a conversation of their own.
58
+ * Who takes part in a thread, from its header: an avatar stack once it is shared, a share button
59
+ * before. It opens a dialog, or a bottom drawer on a phone. The owner adds and removes people; a
60
+ * participant sees who is there, leaves, or continues in a thread of their own.
61
61
  */
62
62
  export function ThreadPeople({ thread, access, user, sharing }: ThreadPeopleProps) {
63
63
  const messages = useAgentMessages().sharing
@@ -76,11 +76,21 @@ export function ThreadPeople({ thread, access, user, sharing }: ThreadPeopleProp
76
76
  if (!next) sharing.resetShare()
77
77
  }
78
78
 
79
+ // Nobody is suggested twice: not the reader, nor whoever is in the thread.
80
+ const exclude = new Set(
81
+ [...people.map((person) => person.principal), ...(user ? [userPrincipal(user)] : [])]
82
+ .filter((principal) => principal?.type === "user")
83
+ .map((principal) => principal?.id ?? "")
84
+ )
85
+
79
86
  const body = (
80
87
  <>
81
- {access === "owner" ? <AddPeople sharing={sharing} emailRef={emailRef} /> : null}
88
+ {access === "owner" ? (
89
+ <AddPeople sharing={sharing} emailRef={emailRef} exclude={exclude} />
90
+ ) : null}
82
91
 
83
92
  <PeopleList
93
+ labelled={access === "owner"}
84
94
  owner={owner}
85
95
  participants={participants}
86
96
  user={user}
@@ -153,7 +163,8 @@ export function ThreadPeople({ thread, access, user, sharing }: ThreadPeopleProp
153
163
  <Dialog open={open} onOpenChange={changeOpen}>
154
164
  <DialogContent
155
165
  showCloseButton={false}
156
- className="flex max-h-[calc(100dvh-2rem)] w-[min(calc(100vw-2rem),30rem)] max-w-[30rem] flex-col gap-0 overflow-hidden rounded-2xl p-0"
166
+ // Held near the top: the dialog grows downward as suggestions open, instead of jumping.
167
+ className="top-[max(4rem,12dvh)] flex max-h-[calc(100dvh-max(4rem,12dvh)-2rem)] w-[min(calc(100vw-2rem),30rem)] max-w-[30rem] translate-y-0 flex-col gap-0 overflow-hidden rounded-2xl p-0"
157
168
  >
158
169
  <div className="flex h-16 shrink-0 items-center gap-3 px-5">
159
170
  <DialogTitle className="text-lg">{title}</DialogTitle>
@@ -219,9 +230,11 @@ function PanelFooter({ children }: { readonly children: ReactNode }) {
219
230
  function AddPeople({
220
231
  sharing,
221
232
  emailRef,
233
+ exclude,
222
234
  }: {
223
235
  readonly sharing: ThreadSharing
224
236
  readonly emailRef: RefObject<HTMLInputElement | null>
237
+ readonly exclude: ReadonlySet<string>
225
238
  }) {
226
239
  const messages = useAgentMessages().sharing
227
240
  const [staged, setStaged] = useState<readonly ParticipantChoice[]>([])
@@ -253,6 +266,7 @@ function AddPeople({
253
266
  <section className="mt-4 flex flex-col">
254
267
  <ParticipantInput
255
268
  staged={staged}
269
+ exclude={exclude}
256
270
  onAdd={stage}
257
271
  onRemove={unstage}
258
272
  disabled={sharing.sharing}
@@ -271,9 +285,12 @@ function AddPeople({
271
285
  <div className="flex min-h-0 flex-col gap-3 overflow-hidden">
272
286
  <p
273
287
  role="note"
274
- className="mt-3 flex items-start gap-2 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2.5 text-xs leading-5 text-amber-800 dark:text-amber-300"
288
+ className="mt-3 flex items-start gap-2 px-1 text-xs leading-5 text-muted-foreground"
275
289
  >
276
- <AlertTriangle aria-hidden className="mt-0.5 size-3.5 shrink-0" />
290
+ <Eye
291
+ aria-hidden
292
+ className="mt-0.5 size-3.5 shrink-0 text-amber-600 dark:text-amber-400"
293
+ />
277
294
  <span>{messages.warning}</span>
278
295
  </p>
279
296
 
@@ -285,7 +302,7 @@ function AddPeople({
285
302
 
286
303
  <Button
287
304
  type="button"
288
- className="self-end"
305
+ className="self-end rounded-full"
289
306
  disabled={sharing.sharing || !ready}
290
307
  onClick={() => void confirm()}
291
308
  >
@@ -299,6 +316,7 @@ function AddPeople({
299
316
  }
300
317
 
301
318
  function PeopleList({
319
+ labelled,
302
320
  owner,
303
321
  participants,
304
322
  user,
@@ -306,6 +324,8 @@ function PeopleList({
306
324
  sharing,
307
325
  emailRef,
308
326
  }: {
327
+ /** Under the field that adds people, a heading says these are already in. */
328
+ readonly labelled: boolean
309
329
  readonly owner: ThreadPerson
310
330
  readonly participants: readonly ThreadPerson[]
311
331
  readonly user: CurrentUser | null
@@ -322,7 +342,10 @@ function PeopleList({
322
342
  }
323
343
 
324
344
  return (
325
- <section className="mt-5">
345
+ <section className="mt-5" aria-label={messages.inThread}>
346
+ {labelled ? (
347
+ <h3 className="px-2 pb-1 text-xs font-medium text-muted-foreground">{messages.inThread}</h3>
348
+ ) : null}
326
349
  <ul className="space-y-0.5">
327
350
  <PersonRow
328
351
  person={owner}
@@ -435,7 +458,12 @@ function LeaveButton({
435
458
  return (
436
459
  <AlertDialog open={open} onOpenChange={(next) => !sharing.leaving && setOpen(next)}>
437
460
  <AlertDialogTrigger asChild>
438
- <Button type="button" variant="ghost" className="gap-1.5 text-muted-foreground">
461
+ <Button
462
+ type="button"
463
+ variant="ghost"
464
+ size="sm"
465
+ className="gap-1.5 rounded-full text-muted-foreground"
466
+ >
439
467
  <LogOut />
440
468
  {messages.leave}
441
469
  </Button>
@@ -474,19 +502,19 @@ function LeaveButton({
474
502
  export function ContinueButton({
475
503
  label,
476
504
  sharing,
477
- variant = "outline",
505
+ variant = "secondary",
478
506
  className,
479
507
  }: {
480
508
  readonly label: string
481
509
  readonly sharing: ThreadSharing
482
- readonly variant?: "outline" | "link"
510
+ readonly variant?: "secondary" | "link"
483
511
  readonly className?: string
484
512
  }) {
485
513
  const messages = useAgentMessages().sharing
486
514
  const hintId = useId()
487
515
 
488
516
  return (
489
- <span className={cn("flex min-w-0 flex-col gap-1", className)}>
517
+ <span className={cn("flex min-w-0 flex-col items-start gap-1", className)}>
490
518
  <Button
491
519
  type="button"
492
520
  variant={variant}
@@ -496,7 +524,9 @@ export function ContinueButton({
496
524
  onClick={() => void sharing.fork()}
497
525
  className={cn(
498
526
  "gap-1.5",
499
- variant === "link" && "h-auto p-0 text-xs whitespace-nowrap has-[>svg]:px-0"
527
+ variant === "link"
528
+ ? "h-auto p-0 text-xs whitespace-nowrap has-[>svg]:px-0"
529
+ : "rounded-full px-3.5"
500
530
  )}
501
531
  >
502
532
  {sharing.forking ? <Spinner className="size-3.5" /> : <GitBranchPlus />}
@@ -0,0 +1,70 @@
1
+ import { Button } from "@sixb/ui/components"
2
+ import { History } from "lucide-react"
3
+ import { useAgentMessages } from "../i18n"
4
+
5
+ const NO_WAITING_THREADS: ReadonlySet<string> = new Set()
6
+
7
+ export interface ThreadsButtonProps {
8
+ /** The thread open beside it, whose own cards say what waits in it. */
9
+ readonly currentThreadId: string | null
10
+ readonly runningThreadCount?: number
11
+ /** The threads where a call waits for the reader: the button counts the others. */
12
+ readonly waitingThreadIds?: ReadonlySet<string>
13
+ readonly onOpen: () => void
14
+ }
15
+
16
+ /**
17
+ * The way from a thread to all of them: a button in its header. It counts the other threads
18
+ * waiting for the reader, in amber, or shows a dot while one is at work.
19
+ */
20
+ export function ThreadsButton({
21
+ currentThreadId,
22
+ runningThreadCount = 0,
23
+ waitingThreadIds = NO_WAITING_THREADS,
24
+ onOpen,
25
+ }: ThreadsButtonProps) {
26
+ const agentMessages = useAgentMessages()
27
+ const messages = agentMessages.threads
28
+ const waitingElsewhere = [...waitingThreadIds].filter(
29
+ (threadId) => threadId !== currentThreadId
30
+ ).length
31
+ const waitingLabel =
32
+ waitingElsewhere > 0 ? agentMessages.approvals.waitingThreads(waitingElsewhere) : null
33
+ const label = [
34
+ messages.open,
35
+ runningThreadCount > 0 ? messages.running(runningThreadCount) : null,
36
+ waitingLabel,
37
+ ]
38
+ .filter(Boolean)
39
+ .join(". ")
40
+
41
+ return (
42
+ <Button
43
+ type="button"
44
+ variant="ghost"
45
+ size="icon-lg"
46
+ aria-label={label}
47
+ title={waitingLabel ?? messages.open}
48
+ onClick={onOpen}
49
+ className="relative [&_svg]:size-5"
50
+ >
51
+ <History />
52
+ {waitingElsewhere > 0 ? (
53
+ // What waits on the reader outranks what is merely running.
54
+ <span
55
+ data-waiting-approval-count={waitingElsewhere}
56
+ aria-hidden="true"
57
+ className="absolute top-1 right-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-amber-500 px-1 text-[10px] leading-none font-semibold text-white tabular-nums ring-2 ring-background"
58
+ >
59
+ {waitingElsewhere > 9 ? "9+" : waitingElsewhere}
60
+ </span>
61
+ ) : runningThreadCount > 0 ? (
62
+ <span
63
+ data-active-thread-count={runningThreadCount}
64
+ aria-hidden="true"
65
+ className="absolute top-1.5 right-1.5 size-2 rounded-full bg-sky-500 ring-2 ring-background motion-safe:animate-pulse"
66
+ />
67
+ ) : null}
68
+ </Button>
69
+ )
70
+ }
@@ -211,7 +211,18 @@ function TranscriptView({
211
211
  />
212
212
  ),
213
213
  }
214
- : {})}
214
+ : message.unfinished
215
+ ? {
216
+ after: (
217
+ <UnfinishedMarker
218
+ unfinished={message.unfinished}
219
+ {...(message.key === newestSavedKey && onContinue
220
+ ? { onContinue, continuing: turn.continuing }
221
+ : {})}
222
+ />
223
+ ),
224
+ }
225
+ : {})}
215
226
  />
216
227
  {calls ? (
217
228
  <MessageScrollerItem messageId={`approvals:${message.key}`}>
@@ -273,6 +284,24 @@ function TranscriptView({
273
284
  )
274
285
  }
275
286
 
287
+ /** A saved reply whose run failed or was stopped before it finished; the newest can go on. */
288
+ function UnfinishedMarker({
289
+ unfinished,
290
+ onContinue,
291
+ continuing = false,
292
+ }: {
293
+ readonly unfinished: "failed" | "cancelled"
294
+ readonly onContinue?: () => void
295
+ readonly continuing?: boolean
296
+ }) {
297
+ const labels = useAgentMessages().transcript
298
+ return unfinished === "failed" ? (
299
+ <RunErrorMarker message={labels.notFinished} onContinue={onContinue} continuing={continuing} />
300
+ ) : (
301
+ <RunCancelledMarker />
302
+ )
303
+ }
304
+
276
305
  /** How the turn of a reply that was never saved ended, below what it streamed. */
277
306
  function TurnEnd({
278
307
  turn,