@sixb/app 0.1.14 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-vtp6nk44.js → chunk-736c9akn.js} +1 -1
- package/dist/{chunk-1rhht9y0.js → chunk-n0cxwvej.js} +1 -1
- package/dist/{chunk-0yb22w6m.js → chunk-qh1panvd.js} +1 -1
- package/dist/{chunk-aes17xmx.js → chunk-twjs2sb9.js} +3928 -3717
- package/dist/{chunk-aes17xmx.js.map → chunk-twjs2sb9.js.map} +46 -42
- package/dist/index.js +15 -6
- package/dist/index.js.map +6 -6
- package/dist/pages.js +60 -44
- package/dist/pages.js.map +8 -8
- package/dist/server.js +12 -6
- package/dist/server.js.map +3 -3
- package/package.json +3 -3
- package/src/agent/agent-chat.tsx +4 -22
- package/src/agent/agent-panel.tsx +4 -0
- package/src/agent/agent-surface.tsx +4 -0
- package/src/agent/agent.css +33 -3
- package/src/agent/approvals.ts +4 -5
- package/src/agent/artifact-panel.tsx +113 -37
- package/src/agent/components/activity-status.tsx +1 -1
- package/src/agent/components/agent-threads.tsx +377 -0
- package/src/agent/components/approval-card.tsx +336 -327
- package/src/agent/components/approval-mode-chip.tsx +38 -145
- package/src/agent/components/auto-model-chip.tsx +103 -167
- package/src/agent/components/composer-menu.tsx +185 -0
- package/src/agent/components/composer.tsx +38 -43
- package/src/agent/components/context-chips.tsx +1 -1
- package/src/agent/components/conversation-panel.tsx +16 -36
- package/src/agent/components/file-attachment-card.tsx +5 -2
- package/src/agent/components/message-parts.tsx +27 -11
- package/src/agent/components/message-view.tsx +182 -68
- package/src/agent/components/model-controls.tsx +133 -125
- package/src/agent/components/model-picker-row.tsx +38 -17
- package/src/agent/components/participant-input.tsx +159 -31
- package/src/agent/components/reasoning-effort-slider.tsx +27 -27
- package/src/agent/components/shared-thread-notice.tsx +1 -1
- package/src/agent/components/thread-people.tsx +45 -15
- package/src/agent/components/threads-button.tsx +70 -0
- package/src/agent/components/transcript.tsx +30 -1
- package/src/agent/conversation.ts +25 -1
- package/src/agent/delegation/child-card.tsx +187 -247
- package/src/agent/delegation/child-cards.tsx +4 -7
- package/src/agent/delegation/child-group.tsx +179 -98
- package/src/agent/delegation/child-parts.tsx +71 -106
- package/src/agent/delegation/child-work.tsx +6 -52
- package/src/agent/delegation/interpret.ts +0 -28
- package/src/agent/delegation/model.ts +115 -39
- package/src/agent/hooks/use-agent-conversation.ts +7 -92
- package/src/agent/hooks/use-people-suggestions.ts +90 -0
- package/src/agent/hooks/use-thread-lists.ts +77 -0
- package/src/agent/i18n/en.ts +96 -83
- package/src/agent/i18n/fr.ts +105 -100
- package/src/agent/react-router.tsx +48 -5
- package/src/agent/run-presentation.ts +6 -2
- package/src/agent/thread-navigation.ts +16 -0
- package/src/agent/thread-pages.ts +24 -0
- package/src/artifacts/person-avatar.tsx +1 -1
- package/src/createCustomApp.ts +13 -6
- package/src/index.ts +7 -3
- package/src/pages/home.tsx +3 -1
- package/src/pages/observability/ai-usage/calls.tsx +2 -1
- package/src/pages/settings/memory-history.tsx +2 -1
- package/src/pages/settings/messages.ts +2 -3
- package/src/pages/values.tsx +23 -1
- package/src/pages.ts +5 -1
- package/src/shell/agent-dock.tsx +4 -2
- package/src/agent/agents-page.ts +0 -7
- package/src/agent/components/agent-thread-switcher.tsx +0 -519
- /package/dist/{chunk-vtp6nk44.js.map → chunk-736c9akn.js.map} +0 -0
- /package/dist/{chunk-1rhht9y0.js.map → chunk-n0cxwvej.js.map} +0 -0
- /package/dist/{chunk-0yb22w6m.js.map → chunk-qh1panvd.js.map} +0 -0
|
@@ -9,10 +9,18 @@ import {
|
|
|
9
9
|
MarkerContent,
|
|
10
10
|
MarkerIcon,
|
|
11
11
|
} from "@sixb/ui/components"
|
|
12
|
-
import {
|
|
12
|
+
import { cn } from "@sixb/ui/lib/utils"
|
|
13
|
+
import {
|
|
14
|
+
AlertTriangle,
|
|
15
|
+
ArrowRight,
|
|
16
|
+
ChevronRight,
|
|
17
|
+
Clock3,
|
|
18
|
+
type LucideIcon,
|
|
19
|
+
RotateCcw,
|
|
20
|
+
Unplug,
|
|
21
|
+
} from "lucide-react"
|
|
13
22
|
import { memo, type ReactNode } from "react"
|
|
14
23
|
import type { FileSource } from "../../artifacts/file-source"
|
|
15
|
-
import { PersonAvatar } from "../../artifacts/person-avatar"
|
|
16
24
|
import type { AgentConversationMessage } from "../conversation"
|
|
17
25
|
import { useAgentMessages } from "../i18n"
|
|
18
26
|
import type { AgentMessages } from "../i18n/en"
|
|
@@ -83,7 +91,9 @@ function UserMessage({
|
|
|
83
91
|
) : null}
|
|
84
92
|
{text ? (
|
|
85
93
|
<Bubble variant="secondary" align="end">
|
|
86
|
-
<BubbleContent className="whitespace-pre-wrap">
|
|
94
|
+
<BubbleContent className="rounded-2xl px-3.5 py-2 text-[15px] whitespace-pre-wrap">
|
|
95
|
+
{text}
|
|
96
|
+
</BubbleContent>
|
|
87
97
|
</Bubble>
|
|
88
98
|
) : null}
|
|
89
99
|
</div>
|
|
@@ -150,12 +160,7 @@ function AssistantMessage({
|
|
|
150
160
|
export function AuthorLine({ author }: { readonly author: AuthorLabel | undefined }) {
|
|
151
161
|
if (!author) return null
|
|
152
162
|
|
|
153
|
-
return
|
|
154
|
-
<p className="mt-2 flex items-center gap-1.5 px-1 text-xs text-muted-foreground">
|
|
155
|
-
<PersonAvatar name={author.name} size="xs" />
|
|
156
|
-
<span>{author.label}</span>
|
|
157
|
-
</p>
|
|
158
|
-
)
|
|
163
|
+
return <p className="mt-2 px-1 text-xs text-muted-foreground">{author.label}</p>
|
|
159
164
|
}
|
|
160
165
|
|
|
161
166
|
function CompactionResult({ summary }: { summary: string }) {
|
|
@@ -198,9 +203,106 @@ export function ThinkingMarker({ takingLonger = false }: { takingLonger?: boolea
|
|
|
198
203
|
)
|
|
199
204
|
}
|
|
200
205
|
|
|
206
|
+
/**
|
|
207
|
+
* How a turn ended short of a full answer: one quiet line, its icon tinted by what happened, and at
|
|
208
|
+
* most one way on. Every ending reads the same way, so only the words and the icon change.
|
|
209
|
+
*/
|
|
210
|
+
function TurnNotice({
|
|
211
|
+
icon: Icon,
|
|
212
|
+
tone = "warning",
|
|
213
|
+
children,
|
|
214
|
+
action,
|
|
215
|
+
}: {
|
|
216
|
+
icon?: LucideIcon
|
|
217
|
+
tone?: "warning" | "error"
|
|
218
|
+
children: ReactNode
|
|
219
|
+
action?: ReactNode
|
|
220
|
+
}) {
|
|
221
|
+
return (
|
|
222
|
+
<div className="flex flex-wrap items-center gap-x-3 gap-y-2" role="status">
|
|
223
|
+
<p className="flex min-w-0 items-center gap-2 text-sm text-muted-foreground">
|
|
224
|
+
{Icon ? (
|
|
225
|
+
<Icon
|
|
226
|
+
aria-hidden="true"
|
|
227
|
+
className={cn(
|
|
228
|
+
"size-4 shrink-0",
|
|
229
|
+
tone === "error" ? "text-destructive" : "text-amber-600 dark:text-amber-400"
|
|
230
|
+
)}
|
|
231
|
+
/>
|
|
232
|
+
) : null}
|
|
233
|
+
<span>{children}</span>
|
|
234
|
+
</p>
|
|
235
|
+
{action}
|
|
236
|
+
</div>
|
|
237
|
+
)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function TurnAction({
|
|
241
|
+
icon: Icon,
|
|
242
|
+
label,
|
|
243
|
+
onClick,
|
|
244
|
+
disabled,
|
|
245
|
+
}: {
|
|
246
|
+
icon: LucideIcon
|
|
247
|
+
label: string
|
|
248
|
+
onClick: () => void
|
|
249
|
+
disabled: boolean
|
|
250
|
+
}) {
|
|
251
|
+
return (
|
|
252
|
+
<Button
|
|
253
|
+
variant="secondary"
|
|
254
|
+
size="sm"
|
|
255
|
+
onClick={onClick}
|
|
256
|
+
disabled={disabled}
|
|
257
|
+
className="h-8 rounded-full px-3"
|
|
258
|
+
>
|
|
259
|
+
<Icon aria-hidden="true" />
|
|
260
|
+
{label}
|
|
261
|
+
</Button>
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** A turn cut short goes on from what it saved, or runs again when it saved nothing. */
|
|
266
|
+
function PickUpAction({
|
|
267
|
+
hasProgress,
|
|
268
|
+
onRetry,
|
|
269
|
+
onContinue,
|
|
270
|
+
retrying,
|
|
271
|
+
continuing,
|
|
272
|
+
}: {
|
|
273
|
+
hasProgress: boolean
|
|
274
|
+
onRetry?: () => void
|
|
275
|
+
onContinue?: () => void
|
|
276
|
+
retrying: boolean
|
|
277
|
+
continuing: boolean
|
|
278
|
+
}) {
|
|
279
|
+
const messages = useAgentMessages().transcript
|
|
280
|
+
if (hasProgress && onContinue) {
|
|
281
|
+
return (
|
|
282
|
+
<TurnAction
|
|
283
|
+
icon={ArrowRight}
|
|
284
|
+
label={continuing ? messages.continuing : messages.continue}
|
|
285
|
+
onClick={onContinue}
|
|
286
|
+
disabled={continuing}
|
|
287
|
+
/>
|
|
288
|
+
)
|
|
289
|
+
}
|
|
290
|
+
if (!hasProgress && onRetry) {
|
|
291
|
+
return (
|
|
292
|
+
<TurnAction
|
|
293
|
+
icon={RotateCcw}
|
|
294
|
+
label={retrying ? messages.retrying : messages.tryAgain}
|
|
295
|
+
onClick={onRetry}
|
|
296
|
+
disabled={retrying}
|
|
297
|
+
/>
|
|
298
|
+
)
|
|
299
|
+
}
|
|
300
|
+
return null
|
|
301
|
+
}
|
|
302
|
+
|
|
201
303
|
export function RunCancelledMarker() {
|
|
202
304
|
const messages = useAgentMessages().transcript
|
|
203
|
-
return <
|
|
305
|
+
return <TurnNotice>{messages.stopped}</TurnNotice>
|
|
204
306
|
}
|
|
205
307
|
|
|
206
308
|
export function RunTimeoutMarker({
|
|
@@ -221,28 +323,20 @@ export function RunTimeoutMarker({
|
|
|
221
323
|
const messages = useAgentMessages().transcript
|
|
222
324
|
const limit = formatTurnTimeout(timeoutMs, messages)
|
|
223
325
|
return (
|
|
224
|
-
<
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
{
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
) : null}
|
|
239
|
-
{!hasProgress && onRetry ? (
|
|
240
|
-
<Button variant="outline" size="sm" onClick={onRetry} disabled={retrying}>
|
|
241
|
-
<RotateCcw aria-hidden="true" />
|
|
242
|
-
{retrying ? messages.retrying : messages.tryAgain}
|
|
243
|
-
</Button>
|
|
244
|
-
) : null}
|
|
245
|
-
</div>
|
|
326
|
+
<TurnNotice
|
|
327
|
+
icon={Clock3}
|
|
328
|
+
action={
|
|
329
|
+
<PickUpAction
|
|
330
|
+
hasProgress={hasProgress}
|
|
331
|
+
onRetry={onRetry}
|
|
332
|
+
onContinue={onContinue}
|
|
333
|
+
retrying={retrying}
|
|
334
|
+
continuing={continuing}
|
|
335
|
+
/>
|
|
336
|
+
}
|
|
337
|
+
>
|
|
338
|
+
{hasProgress ? messages.stoppedAtLimit(limit) : messages.limitBeforeAnswer(limit)}
|
|
339
|
+
</TurnNotice>
|
|
246
340
|
)
|
|
247
341
|
}
|
|
248
342
|
|
|
@@ -262,26 +356,20 @@ export function RunInterruptedMarker({
|
|
|
262
356
|
}) {
|
|
263
357
|
const messages = useAgentMessages().transcript
|
|
264
358
|
return (
|
|
265
|
-
<
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
<Button variant="outline" size="sm" onClick={onRetry} disabled={retrying}>
|
|
280
|
-
<RotateCcw aria-hidden="true" />
|
|
281
|
-
{retrying ? messages.retrying : messages.tryAgain}
|
|
282
|
-
</Button>
|
|
283
|
-
) : null}
|
|
284
|
-
</div>
|
|
359
|
+
<TurnNotice
|
|
360
|
+
icon={Unplug}
|
|
361
|
+
action={
|
|
362
|
+
<PickUpAction
|
|
363
|
+
hasProgress={hasProgress}
|
|
364
|
+
onRetry={onRetry}
|
|
365
|
+
onContinue={onContinue}
|
|
366
|
+
retrying={retrying}
|
|
367
|
+
continuing={continuing}
|
|
368
|
+
/>
|
|
369
|
+
}
|
|
370
|
+
>
|
|
371
|
+
{messages.interrupted}
|
|
372
|
+
</TurnNotice>
|
|
285
373
|
)
|
|
286
374
|
}
|
|
287
375
|
|
|
@@ -294,15 +382,22 @@ export function RunFailureMarker({
|
|
|
294
382
|
}) {
|
|
295
383
|
const messages = useAgentMessages().transcript
|
|
296
384
|
return (
|
|
297
|
-
<
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
385
|
+
<TurnNotice
|
|
386
|
+
icon={AlertTriangle}
|
|
387
|
+
tone="error"
|
|
388
|
+
action={
|
|
389
|
+
onRetry ? (
|
|
390
|
+
<TurnAction
|
|
391
|
+
icon={RotateCcw}
|
|
392
|
+
label={retrying ? messages.retrying : messages.retry}
|
|
393
|
+
onClick={onRetry}
|
|
394
|
+
disabled={retrying}
|
|
395
|
+
/>
|
|
396
|
+
) : null
|
|
397
|
+
}
|
|
398
|
+
>
|
|
399
|
+
{messages.notStarted}
|
|
400
|
+
</TurnNotice>
|
|
306
401
|
)
|
|
307
402
|
}
|
|
308
403
|
|
|
@@ -326,14 +421,33 @@ export function UserFileAttachment({
|
|
|
326
421
|
return <FileAttachmentCard fileRef={fileRef} source={source} />
|
|
327
422
|
}
|
|
328
423
|
|
|
329
|
-
export function RunErrorMarker({
|
|
424
|
+
export function RunErrorMarker({
|
|
425
|
+
message,
|
|
426
|
+
onContinue,
|
|
427
|
+
continuing = false,
|
|
428
|
+
}: {
|
|
429
|
+
message: string
|
|
430
|
+
onContinue?: () => void
|
|
431
|
+
continuing?: boolean
|
|
432
|
+
}) {
|
|
433
|
+
const messages = useAgentMessages().transcript
|
|
330
434
|
return (
|
|
331
|
-
<
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
435
|
+
<TurnNotice
|
|
436
|
+
icon={AlertTriangle}
|
|
437
|
+
tone="error"
|
|
438
|
+
action={
|
|
439
|
+
onContinue ? (
|
|
440
|
+
<TurnAction
|
|
441
|
+
icon={ArrowRight}
|
|
442
|
+
label={continuing ? messages.continuing : messages.continue}
|
|
443
|
+
onClick={onContinue}
|
|
444
|
+
disabled={continuing}
|
|
445
|
+
/>
|
|
446
|
+
) : null
|
|
447
|
+
}
|
|
448
|
+
>
|
|
449
|
+
{message}
|
|
450
|
+
</TurnNotice>
|
|
337
451
|
)
|
|
338
452
|
}
|
|
339
453
|
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import type { ModelReasoningLevel } from "@sixb/core/models"
|
|
2
|
-
import { Popover, PopoverContent, PopoverTrigger } from "@sixb/ui/components"
|
|
3
2
|
import { cn } from "@sixb/ui/lib/utils"
|
|
4
|
-
import { ChevronDown,
|
|
5
|
-
import { useMemo, useState } from "react"
|
|
3
|
+
import { ChevronDown, Search, Shapes } from "lucide-react"
|
|
4
|
+
import { type ComponentPropsWithoutRef, forwardRef, type ReactNode, useMemo, useState } from "react"
|
|
6
5
|
import { useAgentMessages } from "../i18n"
|
|
7
6
|
import type { AgentMessages } from "../i18n/en"
|
|
8
7
|
import { defaultLanguageModel, defaultReasoningLevel, hasTiers } from "../model-selection"
|
|
9
8
|
import type { LanguageModel } from "../types"
|
|
10
9
|
import { AutoModelChip } from "./auto-model-chip"
|
|
10
|
+
import {
|
|
11
|
+
COMPOSER_MENU_SECTION_CLASS_NAME,
|
|
12
|
+
COMPOSER_TRIGGER_CLASS_NAME,
|
|
13
|
+
ComposerMenu,
|
|
14
|
+
ComposerMenuScroll,
|
|
15
|
+
} from "./composer-menu"
|
|
11
16
|
import { ModelPickerRow } from "./model-picker-row"
|
|
12
17
|
import { ProviderLogo } from "./provider-logo"
|
|
13
18
|
import { ReasoningEffortSlider } from "./reasoning-effort-slider"
|
|
@@ -76,8 +81,6 @@ function ModelListControls({
|
|
|
76
81
|
: undefined
|
|
77
82
|
const [query, setQuery] = useState("")
|
|
78
83
|
const normalizedQuery = query.trim().toLowerCase()
|
|
79
|
-
const hasReasoning =
|
|
80
|
-
selectedModel && selectedModel.reasoningLevels.length > 1 && selectedReasoning
|
|
81
84
|
const visibleModels = useMemo(() => {
|
|
82
85
|
if (!normalizedQuery) return models
|
|
83
86
|
return models.filter((model) =>
|
|
@@ -92,131 +95,136 @@ function ModelListControls({
|
|
|
92
95
|
if (!open) setQuery("")
|
|
93
96
|
}
|
|
94
97
|
|
|
98
|
+
// The default model's row follows the project default again instead of pinning that model.
|
|
99
|
+
const choose = (model: LanguageModel) => {
|
|
100
|
+
if (onResetToDefault && !usingDefault && defaultModel && sameModel(model, defaultModel)) {
|
|
101
|
+
onResetToDefault()
|
|
102
|
+
} else {
|
|
103
|
+
onSelectModel(model)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
95
107
|
return (
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
<ComposerMenu
|
|
109
|
+
open={modelOpen}
|
|
110
|
+
onOpenChange={updateModelOpen}
|
|
111
|
+
title={messages.popover}
|
|
112
|
+
align="end"
|
|
113
|
+
trigger={
|
|
114
|
+
<ModelTrigger
|
|
115
|
+
name={
|
|
116
|
+
selectedModel
|
|
117
|
+
? selectedModel.name
|
|
118
|
+
: error
|
|
119
|
+
? messages.unavailable
|
|
120
|
+
: messages.defaultModel
|
|
121
|
+
}
|
|
122
|
+
icon={
|
|
123
|
+
selectedModel ? (
|
|
111
124
|
<ProviderLogo model={selectedModel} className="size-4" />
|
|
112
125
|
) : (
|
|
113
|
-
<Shapes className="size-4" aria-hidden="true" />
|
|
114
|
-
)
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
{
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
))}
|
|
173
|
-
{visibleModels.length === 0 ? (
|
|
174
|
-
<p className="px-3 py-8 text-center text-xs text-muted-foreground">
|
|
175
|
-
{messages.empty}
|
|
176
|
-
</p>
|
|
177
|
-
) : null}
|
|
178
|
-
</div>
|
|
179
|
-
{hasReasoning ? (
|
|
180
|
-
<div className="shrink-0 border-t border-border/60 px-4 py-2.5">
|
|
181
|
-
<ReasoningEffortSlider
|
|
182
|
-
model={selectedModel}
|
|
183
|
-
value={selectedReasoning}
|
|
184
|
-
disabled={disabled}
|
|
185
|
-
onChange={onSelectReasoning}
|
|
186
|
-
onReset={onResetReasoning}
|
|
187
|
-
/>
|
|
188
|
-
</div>
|
|
189
|
-
) : null}
|
|
190
|
-
{defaultSummary && onResetToDefault ? (
|
|
191
|
-
<div className="flex min-h-10 shrink-0 flex-wrap items-center gap-x-2 gap-y-1 border-t border-border/60 px-4 py-1.5 text-xs">
|
|
192
|
-
{usingDefault ? (
|
|
193
|
-
<span className="shrink-0 text-muted-foreground">{messages.default}</span>
|
|
194
|
-
) : (
|
|
195
|
-
<button
|
|
196
|
-
type="button"
|
|
197
|
-
disabled={disabled}
|
|
198
|
-
onClick={onResetToDefault}
|
|
199
|
-
title={messages.defaultSummary(defaultSummary)}
|
|
200
|
-
className="-ml-2 flex shrink-0 items-center gap-1.5 rounded-md px-2 py-1 font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring/40 disabled:opacity-50"
|
|
201
|
-
>
|
|
202
|
-
<RotateCcw className="size-3.5" aria-hidden="true" />
|
|
203
|
-
{messages.resetToDefault}
|
|
204
|
-
</button>
|
|
205
|
-
)}
|
|
206
|
-
<span
|
|
207
|
-
className="min-w-0 flex-1 basis-32 truncate text-right text-muted-foreground"
|
|
208
|
-
title={defaultSummary}
|
|
209
|
-
>
|
|
210
|
-
{defaultSummary}
|
|
211
|
-
</span>
|
|
212
|
-
</div>
|
|
213
|
-
) : null}
|
|
214
|
-
</PopoverContent>
|
|
215
|
-
</Popover>
|
|
216
|
-
</div>
|
|
126
|
+
<Shapes className="size-4 shrink-0" aria-hidden="true" />
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
level={reasoningLabel(selectedModel, selectedReasoning, agentMessages.reasoning)}
|
|
130
|
+
open={modelOpen}
|
|
131
|
+
disabled={disabled || loading || models.length === 0}
|
|
132
|
+
aria-label={messages.choose}
|
|
133
|
+
title={
|
|
134
|
+
usingDefault && defaultSummary
|
|
135
|
+
? messages.defaultSummary(defaultSummary)
|
|
136
|
+
: selectedModel?.name
|
|
137
|
+
}
|
|
138
|
+
/>
|
|
139
|
+
}
|
|
140
|
+
>
|
|
141
|
+
{/* A short catalog is a list to scan; a long one is searched. */}
|
|
142
|
+
{models.length > 10 ? (
|
|
143
|
+
<div className="mx-4 mt-2 flex h-9 shrink-0 items-center gap-2 border-b border-black/[0.06] text-muted-foreground focus-within:border-foreground/30 dark:border-white/[0.07]">
|
|
144
|
+
<Search className="size-3.5 shrink-0" aria-hidden="true" />
|
|
145
|
+
<input
|
|
146
|
+
value={query}
|
|
147
|
+
onChange={(event) => setQuery(event.target.value)}
|
|
148
|
+
placeholder={messages.search}
|
|
149
|
+
aria-label={messages.search}
|
|
150
|
+
className="min-w-0 flex-1 bg-transparent text-[13.5px] text-foreground outline-none placeholder:text-muted-foreground"
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
153
|
+
) : null}
|
|
154
|
+
<ComposerMenuScroll
|
|
155
|
+
className="flex-1 overscroll-contain p-1.5"
|
|
156
|
+
role="group"
|
|
157
|
+
aria-label={messages.list}
|
|
158
|
+
>
|
|
159
|
+
{visibleModels.map((model) => (
|
|
160
|
+
<ModelPickerRow
|
|
161
|
+
key={`${model.provider}:${model.modelId}`}
|
|
162
|
+
model={model}
|
|
163
|
+
selected={sameModel(model, selectedModel)}
|
|
164
|
+
disabled={disabled}
|
|
165
|
+
note={defaultModel && sameModel(model, defaultModel) ? messages.default : undefined}
|
|
166
|
+
onSelect={choose}
|
|
167
|
+
/>
|
|
168
|
+
))}
|
|
169
|
+
{visibleModels.length === 0 ? (
|
|
170
|
+
<p className="px-3 py-8 text-center text-xs text-muted-foreground">{messages.empty}</p>
|
|
171
|
+
) : null}
|
|
172
|
+
</ComposerMenuScroll>
|
|
173
|
+
{selectedModel && selectedReasoning ? (
|
|
174
|
+
<div className={COMPOSER_MENU_SECTION_CLASS_NAME}>
|
|
175
|
+
<ReasoningEffortSlider
|
|
176
|
+
model={selectedModel}
|
|
177
|
+
value={selectedReasoning}
|
|
178
|
+
disabled={disabled}
|
|
179
|
+
onChange={onSelectReasoning}
|
|
180
|
+
onReset={onResetReasoning}
|
|
181
|
+
/>
|
|
182
|
+
</div>
|
|
183
|
+
) : null}
|
|
184
|
+
</ComposerMenu>
|
|
217
185
|
)
|
|
218
186
|
}
|
|
219
187
|
|
|
188
|
+
/**
|
|
189
|
+
* The composer's model control: the model's logo and name, its thinking level in muted text, and
|
|
190
|
+
* a chevron, as quiet text that fills only when hovered or open.
|
|
191
|
+
*/
|
|
192
|
+
export const ModelTrigger = forwardRef<
|
|
193
|
+
HTMLButtonElement,
|
|
194
|
+
{
|
|
195
|
+
readonly icon: ReactNode
|
|
196
|
+
readonly name: string
|
|
197
|
+
readonly level?: string
|
|
198
|
+
readonly open: boolean
|
|
199
|
+
} & ComponentPropsWithoutRef<"button">
|
|
200
|
+
>(function ModelTrigger({ icon, name, level, open, className, ...props }, ref) {
|
|
201
|
+
return (
|
|
202
|
+
<button
|
|
203
|
+
ref={ref}
|
|
204
|
+
type="button"
|
|
205
|
+
aria-expanded={open}
|
|
206
|
+
{...props}
|
|
207
|
+
className={cn(COMPOSER_TRIGGER_CLASS_NAME, className)}
|
|
208
|
+
>
|
|
209
|
+
{icon}
|
|
210
|
+
<span className="max-w-[11rem] truncate text-foreground max-sm:max-w-[7rem]">{name}</span>
|
|
211
|
+
{level ? <span className="shrink-0 text-muted-foreground">{level}</span> : null}
|
|
212
|
+
<ChevronDown className="size-3.5 shrink-0 opacity-60" aria-hidden="true" />
|
|
213
|
+
</button>
|
|
214
|
+
)
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
/** The trigger's level: an explicit one the model offers a choice of. */
|
|
218
|
+
export function reasoningLabel(
|
|
219
|
+
model: LanguageModel | undefined,
|
|
220
|
+
reasoning: ModelReasoningLevel | undefined,
|
|
221
|
+
messages: AgentMessages["reasoning"]
|
|
222
|
+
): string | undefined {
|
|
223
|
+
if (!model || model.reasoningLevels.length <= 1 || !reasoning) return undefined
|
|
224
|
+
if (reasoning === "none" || reasoning === "provider-default") return undefined
|
|
225
|
+
return messages.levels[reasoning]
|
|
226
|
+
}
|
|
227
|
+
|
|
220
228
|
/** "<model> · <level>", omitting a level the provider chooses. */
|
|
221
229
|
function modelSummary(model: LanguageModel, messages: AgentMessages["reasoning"]): string {
|
|
222
230
|
const reasoning = defaultReasoningLevel(model)
|
|
@@ -225,6 +233,6 @@ function modelSummary(model: LanguageModel, messages: AgentMessages["reasoning"]
|
|
|
225
233
|
: `${model.name} · ${messages.levels[reasoning]}`
|
|
226
234
|
}
|
|
227
235
|
|
|
228
|
-
function sameModel(left: LanguageModel, right: LanguageModel | undefined): boolean {
|
|
236
|
+
export function sameModel(left: LanguageModel, right: LanguageModel | undefined): boolean {
|
|
229
237
|
return left.provider === right?.provider && left.modelId === right.modelId
|
|
230
238
|
}
|