Open History to see the last commit
1import {
2 buildTraitsTriggerDisplay,
3 getDescriptorStringValue,
4 isReasoningControl,
5 selectableProviderOptionChoices,
6} from "@t3tools/client-runtime/model-traits";
7import type { ProviderOptionDescriptor, RuntimeMode } from "@t3tools/contracts";
8import type { EffortDisplay } from "@t3tools/contracts/settings";
9import { getProviderOptionCurrentLabel } from "@t3tools/shared/model";
10import { CheckIcon, ChevronRightIcon, ChevronUpIcon } from "lucide-react";
11import { type KeyboardEvent, type ReactNode, use, useRef, useState } from "react";
12
13import { cn } from "~/lib/utils";
14import {
15 Menu,
16 MenuPopup,
17 MenuRadioGroup,
18 MenuRadioItem,
19 MenuRadioItemIndicator,
20 MenuTrigger,
21} from "../ui/menu";
22import { Switch } from "../ui/switch";
23import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
24import type { ComposerControlSize } from "./ComposerControl";
25import { ComposerPermissionsSection, type RuntimeModeOption } from "./ComposerFooterControls";
26import { composerFloatingLayerProps, focusCheckedPermission } from "./composerEventScope";
27import { EffortGlyph, FastBolt, resolveEffortGlyph } from "./EffortGlyph";
28import { DockedPickerContext } from "./ProviderModelPicker";
29import {
30 getTraitsSectionVisibility,
31 type TraitsSelectionInput,
32 ULTRATHINK_IN_BODY_NOTE,
33 useTraitsSelection,
34} from "./TraitsPicker";
35
36type SelectDescriptor = Extract<ProviderOptionDescriptor, { type: "select" }>;
37type BooleanDescriptor = Extract<ProviderOptionDescriptor, { type: "boolean" }>;
38
39/** Codex service tiers and Claude's Fast mode share the footer's speed control. */
40function splitSpeed(
41 provider: TraitsSelectionInput["provider"],
42 selects: ReadonlyArray<SelectDescriptor>,
43 toggles: ReadonlyArray<BooleanDescriptor>,
44) {
45 const speedSelect =
46 provider === "codex"
47 ? (selects.find((descriptor) => descriptor.id === "serviceTier") ?? null)
48 : null;
49 const fastToggle = toggles.find((descriptor) => descriptor.id === "fastMode") ?? null;
50 return {
51 speedSelect,
52 fastToggle,
53 columnSelects: selects.filter((descriptor) => descriptor !== speedSelect),
54 columnToggles: toggles.filter((descriptor) => descriptor !== fastToggle),
55 };
56}
57
58type ColumnControl =
59 | { kind: "select"; descriptor: SelectDescriptor }
60 | { kind: "boolean"; descriptor: BooleanDescriptor };
61
62/**
63 * The column lists the model's reasoning levels under the header that names it. Other options,
64 * such as an agent's session mode, sit below as one row each.
65 */
66function columnControls(
67 provider: TraitsSelectionInput["provider"],
68 selects: ReadonlyArray<SelectDescriptor>,
69 toggles: ReadonlyArray<BooleanDescriptor>,
70) {
71 const { columnSelects, columnToggles } = splitSpeed(provider, selects, toggles);
72 const controls: ReadonlyArray<ColumnControl> = [
73 ...columnSelects.map((descriptor) => ({ kind: "select" as const, descriptor })),
74 ...columnToggles.map((descriptor) => ({ kind: "boolean" as const, descriptor })),
75 ];
76 const effort = controls.find((control) => isReasoningControl(control.descriptor)) ?? null;
77 return { effort, others: controls.filter((control) => control !== effort) };
78}
79
80/**
81 * What the model trigger shows after the model name: the effort word (or bars, per the
82 * Appearance setting), a bolt for Fast, and other traits such as a context window.
83 */
84export function describeComposerEffort(
85 traits: TraitsSelectionInput | null,
86 effortDisplay: EffortDisplay,
87 size: ComposerControlSize,
88): { suffix: ReactNode; detail: string | null } {
89 if (!traits) return { suffix: null, detail: null };
90 const visibility = getTraitsSectionVisibility(traits);
91 if (!visibility.hasAnyControls) return { suffix: null, detail: null };
92 const modelSelection =
93 traits.instanceId && traits.model
94 ? { instanceId: traits.instanceId, model: traits.model, options: traits.modelOptions ?? [] }
95 : null;
96 const primary = visibility.primarySelectDescriptor;
97 const display = buildTraitsTriggerDisplay({
98 provider: traits.provider,
99 descriptors: visibility.descriptors,
100 primarySelectDescriptorId: primary?.id ?? null,
101 ultrathinkPromptControlled: visibility.ultrathinkPromptControlled,
102 modelSelection,
103 reportedModelSelection: traits.reportedModelSelection,
104 });
105 // The same reasoning control the column lists, wherever the agent put it among its options.
106 const reasoning =
107 columnControls(traits.provider, visibility.selectDescriptors, visibility.booleanDescriptors)
108 .effort?.descriptor ?? null;
109 const ultrathink = visibility.ultrathinkPromptControlled && reasoning === primary;
110 const glyph =
111 reasoning?.type === "select"
112 ? resolveEffortGlyph(
113 reasoning,
114 ultrathink
115 ? "ultrathink"
116 : getDescriptorStringValue(reasoning, modelSelection, traits.reportedModelSelection),
117 )
118 : null;
119 // Workflow levels such as Ultracode always show their name; the setting names every level.
120 const word = glyph
121 ? (glyph.special ?? (effortDisplay === "label" ? glyph.label : null))
122 : !reasoning
123 ? null
124 : reasoning.type === "boolean"
125 ? `${reasoning.label} ${reasoning.currentValue === true ? "On" : "Off"}`
126 : ultrathink
127 ? "Ultrathink"
128 : getProviderOptionCurrentLabel(reasoning, modelSelection, traits.reportedModelSelection);
129 const fast = display.speedLabel === "Fast" || display.speedLabel === "Ultrafast";
130 // Agent options such as modes live in the picker; the trigger adds only the context window.
131 const contextWindow =
132 visibility.contextWindowDescriptor &&
133 getProviderOptionCurrentLabel(
134 visibility.contextWindowDescriptor,
135 modelSelection,
136 traits.reportedModelSelection,
137 );
138 if (!word && !glyph && !fast && !contextWindow) return { suffix: null, detail: display.label };
139 return {
140 detail: display.label,
141 suffix: (
142 <span
143 className={cn(
144 "flex shrink-0 items-center gap-1.5 text-muted-foreground group-hover/model-trigger:text-foreground group-data-pressed/model-trigger:text-foreground group-data-popup-open/model-trigger:text-foreground",
145 // A word space after the model name: the regular trigger's gap is wider than one.
146 size === "sm" && "-ms-0.5",
147 )}
148 >
149 {word ? (
150 <span data-composer-control-label className="max-w-24 truncate">
151 {word}
152 </span>
153 ) : glyph ? (
154 <EffortGlyph count={glyph.count} filled={glyph.filled} size={size} />
155 ) : null}
156 {fast ? <FastBolt ultra={display.speedLabel === "Ultrafast"} /> : null}
157 {contextWindow ? (
158 <span
159 // A label, so icon-only footers drop it; compacted rows drop it before the model.
160 data-composer-control-label
161 data-composer-secondary-trait
162 className="max-w-24 truncate text-xs"
163 >
164 {contextWindow}
165 </span>
166 ) : null}
167 </span>
168 ),
169 };
170}
171
172const COLUMN_ROW =
173 "flex h-8 w-full shrink-0 cursor-pointer items-center gap-2 rounded-sm px-2 text-left text-sm text-foreground outline-none hover:bg-foreground/[0.09] focus-visible:bg-foreground/[0.09] disabled:cursor-not-allowed disabled:opacity-64";
174const COLUMN_LABEL = "px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs";
175
176function ColumnRow(props: {
177 label: string;
178 /** Shown on hover; the column is too narrow to print it under the label. */
179 description?: string | undefined;
180 selected: boolean;
181 /** The column's one tab stop: the selected level, else the first when none shows as selected. */
182 tabStop: boolean;
183 isDefault?: boolean | undefined;
184 disabled?: boolean;
185 onPick: () => void;
186}) {
187 const rowProps = {
188 type: "button",
189 role: "radio",
190 "aria-checked": props.selected,
191 disabled: props.disabled,
192 "data-effort-row": true,
193 // Focus lands on a level after a model pick.
194 "data-effort-level": true,
195 // Up and Down move between rows.
196 tabIndex: props.tabStop ? 0 : -1,
197 className: COLUMN_ROW,
198 onClick: props.onPick,
199 } as const;
200 const content = (
201 <>
202 <span className="min-w-0 flex-1 truncate">{props.label}</span>
203 {props.selected ? (
204 <>
205 {props.isDefault ? <span className="sr-only">Default</span> : null}
206 <CheckIcon aria-hidden="true" className="size-3.5" />
207 </>
208 ) : props.isDefault ? (
209 <span className="text-muted-foreground/70 text-xs">Default</span>
210 ) : null}
211 </>
212 );
213 if (!props.description) return <button {...rowProps}>{content}</button>;
214 return (
215 <Tooltip>
216 <TooltipTrigger render={<button {...rowProps} />}>{content}</TooltipTrigger>
217 <TooltipPopup side="right" className="max-w-56">
218 {props.description}
219 </TooltipPopup>
220 </Tooltip>
221 );
222}
223
224function moveBetweenRows(event: KeyboardEvent<HTMLElement>) {
225 if (event.key !== "ArrowDown" && event.key !== "ArrowUp") return;
226 // An option's side menu is a React child here, but it moves through its own items.
227 if (!event.currentTarget.contains(event.target as Node)) return;
228 const rows = Array.from(
229 event.currentTarget.querySelectorAll<HTMLButtonElement>("[data-effort-row]:not(:disabled)"),
230 );
231 const index = rows.findIndex((row) => row === document.activeElement);
232 const next =
233 rows[Math.min(rows.length - 1, Math.max(0, index + (event.key === "ArrowDown" ? 1 : -1)))];
234 if (!next) return;
235 event.preventDefault();
236 event.stopPropagation();
237 next.focus();
238 next.scrollIntoView({ block: "nearest" });
239}
240
241function EffortLevels(props: { traits: TraitsSelectionInput }) {
242 const traits = useTraitsSelection(props.traits);
243 const { effort, others } = columnControls(
244 props.traits.provider,
245 traits.selectDescriptors,
246 traits.booleanDescriptors,
247 );
248 if (traits.modelIsUnavailable) {
249 return (
250 <>
251 {traits.descriptors.map((descriptor) => {
252 const value = traits.currentLabel(descriptor);
253 return value ? (
254 <div key={descriptor.id}>
255 <div className={COLUMN_LABEL}>{descriptor.label}</div>
256 <div className="px-2 pb-1.5 text-muted-foreground/80 text-xs">{value}</div>
257 </div>
258 ) : null;
259 })}
260 </>
261 );
262 }
263 if (!effort && others.length === 0) return <NoEffortRow />;
264 // Ultrathink in the prompt locks the levels; the first option then holds the tab stop.
265 const locked =
266 effort?.descriptor.id === traits.primarySelectDescriptor?.id && traits.ultrathinkInBodyText;
267 return (
268 <>
269 {effort ? <EffortRows control={effort} traits={traits} locked={locked} /> : null}
270 {others.length > 0 ? (
271 <div
272 className={cn("flex flex-col gap-0.5", effort && "mt-1 border-t border-border/70 pt-1")}
273 >
274 {others.map((control, index) =>
275 control.kind === "boolean" ? (
276 <OptionSwitchRow
277 key={control.descriptor.id}
278 descriptor={control.descriptor}
279 traits={traits}
280 tabStop={(!effort || locked) && index === 0}
281 />
282 ) : (
283 <OptionMenuRow
284 key={control.descriptor.id}
285 descriptor={control.descriptor}
286 traits={traits}
287 tabStop={(!effort || locked) && index === 0}
288 />
289 ),
290 )}
291 </div>
292 ) : null}
293 </>
294 );
295}
296
297type TraitsSelection = ReturnType<typeof useTraitsSelection>;
298
299function EffortRows(props: { control: ColumnControl; traits: TraitsSelection; locked: boolean }) {
300 const { control, traits } = props;
301 const { descriptor } = control;
302 if (control.kind === "boolean") {
303 return (
304 <div role="radiogroup" aria-label={descriptor.label} className="flex flex-col gap-0.5">
305 {([true, false] as const).map((value) => (
306 <ColumnRow
307 key={String(value)}
308 label={value ? "On" : "Off"}
309 selected={(control.descriptor.currentValue === true) === value}
310 tabStop={(control.descriptor.currentValue === true) === value}
311 onPick={() => traits.changeBoolean(descriptor.id, value)}
312 />
313 ))}
314 </div>
315 );
316 }
317 const { locked } = props;
318 const value = traits.selectValue(control.descriptor);
319 const choices = selectableProviderOptionChoices(control.descriptor);
320 // An "Ultrathink:" prefix selects a level the column does not offer.
321 const shown = choices.some((option) => option.id === value);
322 return (
323 <div role="radiogroup" aria-label={descriptor.label} className="flex flex-col gap-0.5">
324 {locked ? (
325 <div className="px-2 pb-1.5 text-muted-foreground/80 text-xs">
326 {ULTRATHINK_IN_BODY_NOTE}
327 </div>
328 ) : null}
329 {choices.map((option, index) => (
330 <ColumnRow
331 key={option.id}
332 label={option.label}
333 selected={option.id === value}
334 tabStop={shown ? option.id === value : index === 0}
335 description={option.description}
336 isDefault={option.isDefault}
337 disabled={locked}
338 onPick={() => traits.changeSelect(control.descriptor, option.id)}
339 />
340 ))}
341 </div>
342 );
343}
344
345const OPTION_ROW = cn(COLUMN_ROW, "h-auto py-1");
346
347/** An option's name over its current value. */
348function OptionRowText(props: { label: string; value: string }) {
349 return (
350 <span className="flex min-w-0 flex-1 flex-col">
351 <span className="truncate text-muted-foreground text-xs">{props.label}</span>
352 <span className="truncate">{props.value}</span>
353 </span>
354 );
355}
356
357/**
358 * One select besides reasoning, such as an agent's session mode. It names the current choice and
359 * opens the rest beside the column, so any number of options leaves the levels in place.
360 */
361function OptionMenuRow(props: {
362 descriptor: SelectDescriptor;
363 traits: TraitsSelection;
364 /** Holds the column's tab stop when the model has no levels. */
365 tabStop: boolean;
366}) {
367 const { descriptor, traits } = props;
368 const [open, setOpen] = useState(false);
369 const popupRef = useRef<HTMLDivElement>(null);
370 const choices = selectableProviderOptionChoices(descriptor);
371 const value = traits.selectValue(descriptor);
372 const current = choices.find((choice) => choice.id === value)?.label ?? "";
373 return (
374 <Menu
375 open={open}
376 // A modal menu would cover the picker, so the next click there would only close it.
377 modal={false}
378 onOpenChange={setOpen}
379 onOpenChangeComplete={(isOpen) => {
380 if (!isOpen) return;
381 const checked = popupRef.current?.querySelector<HTMLElement>(
382 '[role="menuitemradio"][aria-checked="true"]',
383 );
384 checked?.focus({ preventScroll: true });
385 checked?.scrollIntoView({ block: "nearest" });
386 }}
387 >
388 {/* No hover opening: an opened menu takes focus, which would steal typing from search. */}
389 <MenuTrigger
390 render={
391 <button
392 type="button"
393 data-effort-row
394 tabIndex={props.tabStop ? 0 : -1}
395 aria-label={`${descriptor.label}: ${current}`}
396 className={cn(OPTION_ROW, "data-popup-open:bg-foreground/[0.09]")}
397 onKeyDown={(event) => {
398 if (event.key !== "ArrowRight") return;
399 event.preventDefault();
400 event.stopPropagation();
401 setOpen(true);
402 }}
403 />
404 }
405 >
406 <OptionRowText label={descriptor.label} value={current} />
407 <ChevronRightIcon
408 aria-hidden="true"
409 className="-me-1 size-3.5 shrink-0 text-muted-foreground"
410 />
411 </MenuTrigger>
412 <MenuPopup
413 ref={popupRef}
414 side="right"
415 align="start"
416 sideOffset={6}
417 // A full-width column on phones leaves no room beside it, so fall below or above.
418 collisionAvoidance={{ fallbackAxisSide: "end" }}
419 className="max-w-72"
420 data-model-picker-option-menu
421 {...composerFloatingLayerProps}
422 onKeyDown={(event) => {
423 if (event.key !== "ArrowLeft") return;
424 event.preventDefault();
425 event.stopPropagation();
426 setOpen(false);
427 }}
428 >
429 <MenuRadioGroup
430 aria-label={descriptor.label}
431 value={value}
432 onValueChange={(next: string) => {
433 if (next !== value) traits.changeSelect(descriptor, next);
434 }}
435 >
436 {choices.map((choice) => (
437 <MenuRadioItem key={choice.id} value={choice.id} closeOnClick>
438 <span className="flex items-center gap-3">
439 <span className="flex min-w-0 flex-1 flex-col">
440 <span className="truncate">{choice.label}</span>
441 {choice.description ? (
442 <span className="line-clamp-2 text-muted-foreground text-xs">
443 {choice.description}
444 </span>
445 ) : null}
446 </span>
447 {choice.isDefault ? (
448 <span className="text-muted-foreground/70 text-xs">Default</span>
449 ) : null}
450 <MenuRadioItemIndicator />
451 </span>
452 </MenuRadioItem>
453 ))}
454 </MenuRadioGroup>
455 </MenuPopup>
456 </Menu>
457 );
458}
459
460/** A two-state option toggles in place; a menu would add a click for nothing. */
461function OptionSwitchRow(props: {
462 descriptor: BooleanDescriptor;
463 traits: TraitsSelection;
464 tabStop: boolean;
465}) {
466 const { descriptor, traits } = props;
467 const checked = descriptor.currentValue === true;
468 return (
469 <label className={cn(OPTION_ROW, "has-focus-visible:bg-foreground/[0.09]")}>
470 <OptionRowText label={descriptor.label} value={checked ? "On" : "Off"} />
471 <Switch
472 size="sm"
473 checked={checked}
474 onCheckedChange={(next) => traits.changeBoolean(descriptor.id, next)}
475 aria-label={descriptor.label}
476 data-effort-row
477 tabIndex={props.tabStop ? 0 : -1}
478 />
479 </label>
480 );
481}
482
483function NoEffortRow() {
484 return (
485 <div className="flex h-8 items-center px-2 text-muted-foreground text-sm">No effort levels</div>
486 );
487}
488
489/** The model picker's effort column: the selected model's levels and its other options. */
490export function ComposerEffortColumn(props: { traits: TraitsSelectionInput | null }) {
491 const picker = use(DockedPickerContext);
492 const visibility = props.traits ? getTraitsSectionVisibility(props.traits) : null;
493 const controls =
494 props.traits && visibility
495 ? columnControls(
496 props.traits.provider,
497 visibility.selectDescriptors,
498 visibility.booleanDescriptors,
499 )
500 : null;
501 return (
502 <>
503 {/* Matches the search row's box, so one rule runs across the top of the popup. */}
504 <div className="shrink-0 px-3 pt-2.5">
505 <div className="flex h-8.25 -translate-y-px items-center gap-2 border-b border-border/70 pb-1.5 text-sm">
506 <span className="text-muted-foreground">
507 {controls?.effort?.descriptor.label ?? (controls?.others.length ? "Options" : "Effort")}
508 </span>
509 <span className="ms-auto min-w-0 truncate text-muted-foreground text-xs">
510 {picker.modelLabel}
511 </span>
512 </div>
513 </div>
514 {/* pt-2.5 puts the first level on the same line as the first model. */}
515 <div
516 className="flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto overscroll-contain px-2 pt-2.5 pb-1.5"
517 // Capture, so Up and Down on an option row move rows instead of opening its menu.
518 onKeyDownCapture={moveBetweenRows}
519 >
520 {props.traits ? <EffortLevels traits={props.traits} /> : <NoEffortRow />}
521 </div>
522 </>
523 );
524}
525
526const FOOTER_SEGMENT =
527 "flex h-6 cursor-pointer items-center justify-center gap-1 px-2 text-muted-foreground text-xs outline-none first:rounded-l-md last:rounded-r-md hover:text-foreground data-checked:bg-input/72 data-checked:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset";
528
529function SpeedSegment(props: {
530 checked: boolean;
531 label: string;
532 description?: string | undefined;
533 onPick: () => void;
534}) {
535 const buttonProps = {
536 type: "button",
537 role: "radio",
538 "aria-checked": props.checked,
539 "data-checked": props.checked || undefined,
540 className: FOOTER_SEGMENT,
541 onClick: props.onPick,
542 } as const;
543 const content = (
544 <>
545 {props.label === "Fast" || props.label === "Ultrafast" ? (
546 <FastBolt ultra={props.label === "Ultrafast"} />
547 ) : null}
548 {props.label}
549 </>
550 );
551 if (!props.description) return <button {...buttonProps}>{content}</button>;
552 return (
553 <Tooltip>
554 <TooltipTrigger render={<button {...buttonProps} />}>{content}</TooltipTrigger>
555 <TooltipPopup side="top">{props.description}</TooltipPopup>
556 </Tooltip>
557 );
558}
559
560function SpeedControl(props: { traits: TraitsSelectionInput }) {
561 const traits = useTraitsSelection(props.traits);
562 const { speedSelect, fastToggle } = splitSpeed(
563 props.traits.provider,
564 traits.selectDescriptors,
565 traits.booleanDescriptors,
566 );
567 if (traits.modelIsUnavailable || (!speedSelect && !fastToggle)) return null;
568 return (
569 <div
570 role="radiogroup"
571 aria-label={speedSelect?.label ?? fastToggle?.label}
572 className="flex rounded-lg bg-input/40 p-0.5"
573 >
574 {speedSelect
575 ? selectableProviderOptionChoices(speedSelect).map((option) => (
576 <SpeedSegment
577 key={option.id}
578 checked={option.id === traits.selectValue(speedSelect)}
579 label={option.label}
580 description={option.description}
581 onPick={() => traits.changeSelect(speedSelect, option.id)}
582 />
583 ))
584 : fastToggle
585 ? ([false, true] as const).map((value) => (
586 <SpeedSegment
587 key={String(value)}
588 checked={(fastToggle.currentValue === true) === value}
589 label={value ? "Fast" : "Standard"}
590 onPick={() => traits.changeBoolean(fastToggle.id, value)}
591 />
592 ))
593 : null}
594 </div>
595 );
596}
597
598/** Permissions change rarely, so the footer names the mode and nests the choice in a menu. */
599function PermissionsMenu(props: {
600 runtimeMode: RuntimeMode;
601 options: ReadonlyArray<RuntimeModeOption>;
602 onChange: (mode: RuntimeMode) => void;
603}) {
604 const triggerRef = useRef<HTMLButtonElement>(null);
605 const current = props.options.find((option) => option.mode === props.runtimeMode);
606 if (!current) return null;
607 const CurrentIcon = current.icon;
608 return (
609 <Menu
610 onOpenChangeComplete={(open) => {
611 if (open) focusCheckedPermission(triggerRef.current);
612 }}
613 >
614 <MenuTrigger
615 render={
616 <button
617 ref={triggerRef}
618 type="button"
619 data-composer-permissions-trigger
620 aria-label={`Permissions: ${current.label}`}
621 className="ms-auto flex h-7 cursor-pointer items-center gap-1.5 rounded-md px-2 text-muted-foreground text-xs outline-none hover:bg-foreground/[0.09] hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset data-popup-open:bg-foreground/[0.09] data-popup-open:text-foreground"
622 />
623 }
624 >
625 <CurrentIcon aria-hidden="true" className="size-3.5" />
626 {current.label}
627 <ChevronUpIcon aria-hidden="true" className="size-3" />
628 </MenuTrigger>
629 <MenuPopup side="top" align="end" {...composerFloatingLayerProps}>
630 <ComposerPermissionsSection
631 runtimeMode={props.runtimeMode}
632 runtimeModeOptions={props.options}
633 onRuntimeModeChange={props.onChange}
634 />
635 </MenuPopup>
636 </Menu>
637 );
638}
639
640/** The model picker's footer: speed stays one click away, permissions sit one menu deeper. */
641export function ComposerPickerFooter(props: {
642 traits: TraitsSelectionInput | null;
643 runtimeMode: RuntimeMode;
644 runtimeModeOptions: ReadonlyArray<RuntimeModeOption>;
645 onRuntimeModeChange: (mode: RuntimeMode) => void;
646}) {
647 return (
648 <div className="flex flex-wrap items-center gap-2 border-t border-border/70 bg-muted/40 px-3 py-2">
649 {props.traits ? <SpeedControl traits={props.traits} /> : null}
650 <PermissionsMenu
651 runtimeMode={props.runtimeMode}
652 options={props.runtimeModeOptions}
653 onChange={props.onRuntimeModeChange}
654 />
655 </div>
656 );
657}