@@ -129,97 +129,151 @@ export function ProjectDefaultsSettings({ category }: { category: ProjectSetting
129129 updateSettings ( { defaultModelSelection : value } ) ;
130130 } ;
131131
132+ const modelRow = (
133+ < SettingsRow
134+ serverScoped
135+ settingKeys = { [ "defaultModelSelection" ] }
136+ mixed = { mixedModel }
137+ id = "default-model"
138+ title = "Model"
139+ description = {
140+ isProjectScope
141+ ? "Model for new threads in this project."
142+ : "Default model for new threads. Projects can override it."
143+ }
144+ status = {
145+ unavailable || mixedModel || modelSource === "project"
146+ ? undefined
147+ : settings . defaultModelSelection === null
148+ ? "Automatic"
149+ : undefined
150+ }
151+ resetAction = {
152+ settings . defaultModelSelection !== null ? (
153+ < SettingResetButton label = "default model" onClick = { ( ) => setModel ( null ) } />
154+ ) : null
155+ }
156+ control = {
157+ selection && activeEntry ? (
158+ < div className = "flex min-w-0 flex-wrap items-center justify-end gap-1.5" >
159+ < ProviderModelPicker
160+ activeInstanceId = { selection . instanceId }
161+ model = { selection . model }
162+ lockedProvider = { null }
163+ instanceEntries = { entries }
164+ modelOptionsByInstance = { modelOptions }
165+ triggerVariant = "outline"
166+ triggerClassName = { SETTINGS_PICKER_TRIGGER_CLASSNAME }
167+ { ...( mixedModel ? { triggerLabel : "Mixed" } : { } ) }
168+ getModelDisabledReason = { modelDisabledReason }
169+ onOpenProviderSetup = { ( instanceId ) => {
170+ if ( representative )
171+ void navigate ( {
172+ to : "/settings/providers" ,
173+ search : { environmentId : representative . environmentId , instanceId } ,
174+ } ) ;
175+ } }
176+ onInstanceModelChange = { ( instanceId , model ) =>
177+ setModel ( createModelSelection ( instanceId , model ) )
178+ }
179+ />
180+ { ! mixedModel ? (
181+ < TraitsPicker
182+ provider = { activeEntry . driverKind }
183+ models = { activeEntry . models }
184+ model = { selection . model }
185+ prompt = ""
186+ onPromptChange = { ( ) => { } }
187+ modelOptions = { selection . options ?? [ ] }
188+ allowPromptInjectedEffort = { false }
189+ planModeEnabled = { settings . planModeEnabled }
190+ triggerVariant = "outline"
191+ triggerClassName = { SETTINGS_PICKER_TRIGGER_CLASSNAME }
192+ onModelOptionsChange = { ( options ) =>
193+ setModel ( createModelSelection ( selection . instanceId , selection . model , options ) )
194+ }
195+ />
196+ ) : null }
197+ </ div >
198+ ) : (
199+ < span className = "text-sm text-muted-foreground" > No providers available</ span >
200+ )
201+ }
202+ />
203+ ) ;
204+ const workspaceRow = (
205+ < SettingsRow
206+ serverScoped
207+ settingKeys = { [ "defaultThreadEnvMode" ] }
208+ mixed = { mixedWorkspace }
209+ id = { searchableSetting ( "new-threads" ) . id }
210+ title = "Workspace"
211+ description = {
212+ isProjectScope
213+ ? "Where new threads in this project start."
214+ : "Where new threads start. Projects and their t3.json can override it."
215+ }
216+ resetAction = {
217+ ! isProjectScope && settings . defaultThreadEnvMode !== null ? (
218+ < SettingResetButton
219+ label = "default workspace"
220+ onClick = { ( ) => updateSettings ( { defaultThreadEnvMode : null } ) }
221+ />
222+ ) : null
223+ }
224+ control = {
225+ < Select
226+ value = { mixedWorkspace ? null : ( effective ?. defaultThreadEnvMode ?? null ) }
227+ onValueChange = { ( value ) => {
228+ if ( value === "local" || value === "worktree" )
229+ updateSettings ( { defaultThreadEnvMode : value } ) ;
230+ } }
231+ >
232+ < SelectTrigger size = "sm" aria-label = "Default workspace" >
233+ < SelectValue >
234+ { ( value : string | null ) =>
235+ value === "local" || value === "worktree"
236+ ? resolveEnvModeLabel ( value )
237+ : unavailable
238+ ? "Unavailable"
239+ : "Mixed"
240+ }
241+ </ SelectValue >
242+ </ SelectTrigger >
243+ < SelectPopup align = "end" alignItemWithTrigger = { false } >
244+ < SelectItem value = "local" > { resolveEnvModeLabel ( "local" ) } </ SelectItem >
245+ < SelectItem value = "worktree" > { resolveEnvModeLabel ( "worktree" ) } </ SelectItem >
246+ </ SelectPopup >
247+ </ Select >
248+ }
249+ />
250+ ) ;
251+
132252 return (
133253 < SettingsSection
134254 id = {
135- category === "general"
255+ category === "general" || category === "project"
136256 ? "project-defaults"
137257 : category === "integrations"
138258 ? "browser-access"
139259 : "source-control-defaults"
140260 }
141261 title = {
142- category === "general"
262+ category === "general" || category === "project"
143263 ? "New threads"
144264 : category === "integrations"
145265 ? "Browser"
146266 : "Repositories"
147267 }
148268 >
149- { category === "general " ? (
269+ { category === "project " ? (
150270 < >
151- < SettingsRow
152- serverScoped
153- settingKeys = { [ "defaultModelSelection" ] }
154- mixed = { mixedModel }
155- id = "default-model"
156- title = "Model"
157- description = {
158- isProjectScope
159- ? "Model for new threads in this project."
160- : "Default model for new threads. Projects can override it."
161- }
162- status = {
163- unavailable || mixedModel || modelSource === "project"
164- ? undefined
165- : settings . defaultModelSelection === null
166- ? "Automatic"
167- : undefined
168- }
169- resetAction = {
170- settings . defaultModelSelection !== null ? (
171- < SettingResetButton label = "default model" onClick = { ( ) => setModel ( null ) } />
172- ) : null
173- }
174- control = {
175- selection && activeEntry ? (
176- < div className = "flex min-w-0 flex-wrap items-center justify-end gap-1.5" >
177- < ProviderModelPicker
178- activeInstanceId = { selection . instanceId }
179- model = { selection . model }
180- lockedProvider = { null }
181- instanceEntries = { entries }
182- modelOptionsByInstance = { modelOptions }
183- triggerVariant = "outline"
184- triggerClassName = { SETTINGS_PICKER_TRIGGER_CLASSNAME }
185- { ...( mixedModel ? { triggerLabel : "Mixed" } : { } ) }
186- getModelDisabledReason = { modelDisabledReason }
187- onOpenProviderSetup = { ( instanceId ) => {
188- if ( representative )
189- void navigate ( {
190- to : "/settings/providers" ,
191- search : { environmentId : representative . environmentId , instanceId } ,
192- } ) ;
193- } }
194- onInstanceModelChange = { ( instanceId , model ) =>
195- setModel ( createModelSelection ( instanceId , model ) )
196- }
197- />
198- { ! mixedModel ? (
199- < TraitsPicker
200- provider = { activeEntry . driverKind }
201- models = { activeEntry . models }
202- model = { selection . model }
203- prompt = ""
204- onPromptChange = { ( ) => { } }
205- modelOptions = { selection . options ?? [ ] }
206- allowPromptInjectedEffort = { false }
207- planModeEnabled = { settings . planModeEnabled }
208- triggerVariant = "outline"
209- triggerClassName = { SETTINGS_PICKER_TRIGGER_CLASSNAME }
210- onModelOptionsChange = { ( options ) =>
211- setModel (
212- createModelSelection ( selection . instanceId , selection . model , options ) ,
213- )
214- }
215- />
216- ) : null }
217- </ div >
218- ) : (
219- < span className = "text-sm text-muted-foreground" > No providers available</ span >
220- )
221- }
222- />
271+ { modelRow }
272+ { workspaceRow }
273+ </ >
274+ ) : category === "general" ? (
275+ < >
276+ { modelRow }
223277 < SettingsRow
224278 serverScoped
225279 settingKeys = { [ "defaultRuntimeMode" ] }
@@ -281,51 +335,7 @@ export function ProjectDefaultsSettings({ category }: { category: ProjectSetting
281335 </ Select >
282336 }
283337 />
284- < SettingsRow
285- serverScoped
286- settingKeys = { [ "defaultThreadEnvMode" ] }
287- mixed = { mixedWorkspace }
288- id = { searchableSetting ( "new-threads" ) . id }
289- title = "Workspace"
290- description = {
291- isProjectScope
292- ? "Where new threads in this project start."
293- : "Where new threads start. Projects and their t3.json can override it."
294- }
295- resetAction = {
296- ! isProjectScope && settings . defaultThreadEnvMode !== null ? (
297- < SettingResetButton
298- label = "default workspace"
299- onClick = { ( ) => updateSettings ( { defaultThreadEnvMode : null } ) }
300- />
301- ) : null
302- }
303- control = {
304- < Select
305- value = { mixedWorkspace ? null : ( effective ?. defaultThreadEnvMode ?? null ) }
306- onValueChange = { ( value ) => {
307- if ( value === "local" || value === "worktree" )
308- updateSettings ( { defaultThreadEnvMode : value } ) ;
309- } }
310- >
311- < SelectTrigger size = "sm" aria-label = "Default workspace" >
312- < SelectValue >
313- { ( value : string | null ) =>
314- value === "local" || value === "worktree"
315- ? resolveEnvModeLabel ( value )
316- : unavailable
317- ? "Unavailable"
318- : "Mixed"
319- }
320- </ SelectValue >
321- </ SelectTrigger >
322- < SelectPopup align = "end" alignItemWithTrigger = { false } >
323- < SelectItem value = "local" > { resolveEnvModeLabel ( "local" ) } </ SelectItem >
324- < SelectItem value = "worktree" > { resolveEnvModeLabel ( "worktree" ) } </ SelectItem >
325- </ SelectPopup >
326- </ Select >
327- }
328- />
338+ { workspaceRow }
329339 < SettingsRow
330340 serverScoped
331341 settingKeys = { [ "worktreeSubmodules" ] }
0 commit comments