1+ import type * as React from "react" ;
12import { Tabs , TabsList , TabsTrigger } from "@/shared/ui/tabs" ;
23import type { AgentAiConfigurationMode } from "./agentAiConfigurationPolicy" ;
4+ import { AgentAiDefaultsNotice } from "./AgentAiDefaults" ;
5+ import type { InheritedDefault } from "./bakedEnvHelpers" ;
36
47export type { AgentAiConfigurationMode } from "./agentAiConfigurationPolicy" ;
58
69export function HarnessModelDefaultNotice ( {
10+ harness,
711 model,
812} : {
13+ harness : string ;
914 model ?: string | null ;
1015} ) {
1116 return (
12- < div className = "text-sm" data-testid = "agent-harness-defaults-notice" >
13- < span className = "text-muted-foreground" > Model</ span > { " " }
14- < span className = "text-foreground" >
17+ < dl
18+ className = "grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 text-sm"
19+ data-testid = "agent-harness-defaults-notice"
20+ >
21+ < dt className = "text-muted-foreground" > Harness</ dt >
22+ < dd className = "truncate text-foreground" >
23+ { harness || "Not configured" }
24+ </ dd >
25+ < dt className = "text-muted-foreground" > Model</ dt >
26+ < dd className = "truncate text-foreground" >
1527 { model ?. trim ( ) || "Harness default" }
16- </ span >
17- </ div >
28+ </ dd >
29+ </ dl >
30+ ) ;
31+ }
32+
33+ export function AgentCreateAiDefaultsSummary ( {
34+ canChooseProvider,
35+ harness,
36+ inheritedModel,
37+ inheritedProvider,
38+ isConfigured,
39+ model,
40+ onEditDefaults,
41+ triggerRef,
42+ } : {
43+ canChooseProvider : boolean ;
44+ harness : string ;
45+ inheritedModel : InheritedDefault ;
46+ inheritedProvider : InheritedDefault ;
47+ isConfigured : boolean ;
48+ model ?: string | null ;
49+ onEditDefaults : ( ) => void ;
50+ triggerRef ?: React . Ref < HTMLButtonElement > ;
51+ } ) {
52+ return canChooseProvider ? (
53+ < AgentAiDefaultsNotice
54+ isConfigured = { isConfigured }
55+ onEditDefaults = { onEditDefaults }
56+ triggerRef = { triggerRef }
57+ explicitModel = ""
58+ explicitProvider = ""
59+ harness = { harness }
60+ inheritedModel = { inheritedModel }
61+ inheritedProvider = { inheritedProvider }
62+ />
63+ ) : (
64+ < HarnessModelDefaultNotice harness = { harness } model = { model } />
1865 ) ;
1966}
2067
@@ -36,22 +83,31 @@ export function AgentAiConfigurationModeField({
3683 }
3784 value = { mode }
3885 >
39- < TabsList >
40- < TabsTrigger value = "defaults" >
86+ < TabsList className = "relative isolate grid h-9 w-full grid-cols-2 overflow-hidden rounded-lg bg-muted p-0.5" >
87+ < div
88+ aria-hidden = "true"
89+ className = "absolute bottom-0.5 left-0.5 top-0.5 z-0 rounded-md bg-background shadow-sm transition-transform duration-[250ms] ease-out"
90+ style = { {
91+ transform : `translateX(${ mode === "custom" ? 100 : 0 } %)` ,
92+ width : "calc((100% - 4px) / 2)" ,
93+ } }
94+ />
95+ < TabsTrigger
96+ className = "relative z-10 h-full rounded-md bg-transparent text-xs font-medium shadow-none transition-colors data-[state=active]:bg-transparent data-[state=active]:shadow-none"
97+ value = "defaults"
98+ >
4199 { needsProviderSelection
42100 ? "Use agent defaults"
43101 : "Use harness defaults" }
44102 </ TabsTrigger >
45- < TabsTrigger value = "custom" > Customize for this agent</ TabsTrigger >
103+ < TabsTrigger
104+ className = "relative z-10 h-full rounded-md bg-transparent text-xs font-medium shadow-none transition-colors data-[state=active]:bg-transparent data-[state=active]:shadow-none"
105+ value = "custom"
106+ >
107+ Customize for this agent
108+ </ TabsTrigger >
46109 </ TabsList >
47110 </ Tabs >
48- { mode === "custom" ? (
49- < p className = "text-xs text-muted-foreground" >
50- { needsProviderSelection
51- ? "Provider and model changes apply only to this agent."
52- : "Model changes apply only to this agent." }
53- </ p >
54- ) : null }
55111 </ div >
56112 ) ;
57113}
0 commit comments