@@ -46,7 +46,12 @@ import {
4646} from '@/lib/mothership/chat/selection-context'
4747import { COPILOT_REQUEST_MODES } from '@/lib/mothership/constants'
4848import { prepareCopilotEnvironmentContext } from '@/lib/mothership/environment-context'
49- import { type ChatRequest , PROTOCOL_VERSION } from '@/lib/mothership/generated/protocol'
49+ import {
50+ type ChatRequest ,
51+ type ModelSelection ,
52+ ModelSelectionSchema ,
53+ PROTOCOL_VERSION ,
54+ } from '@/lib/mothership/generated/protocol'
5055import { CopilotTransport } from '@/lib/mothership/generated/trace-attribute-values-v1'
5156import { TraceAttr } from '@/lib/mothership/generated/trace-attributes-v1'
5257import { TraceSpan } from '@/lib/mothership/generated/trace-spans-v1'
@@ -268,6 +273,7 @@ const ChatMessageSchema = z
268273 commands : z . array ( z . string ( ) ) . optional ( ) ,
269274 userTimezone : z . string ( ) . optional ( ) ,
270275 effort : z . enum ( [ 'low' , 'medium' , 'high' , 'xhigh' , 'max' ] ) . optional ( ) ,
276+ modelSelection : ModelSelectionSchema . optional ( ) ,
271277 clientCapabilities : z . array ( z . string ( ) ) . optional ( ) ,
272278 desktopCapabilities : z
273279 . object ( {
@@ -338,6 +344,7 @@ type UnifiedChatBranch =
338344 userPermission ?: string
339345 userTimezone ?: string
340346 effort ?: 'low' | 'medium' | 'high' | 'xhigh' | 'max'
347+ modelSelection ?: ModelSelection
341348 workflowId : string
342349 workflowName ?: string
343350 workspaceId : string
@@ -388,6 +395,7 @@ type UnifiedChatBranch =
388395 workspaceContext ?: string
389396 vfs ?: VfsSnapshotV1
390397 effort ?: 'low' | 'medium' | 'high' | 'xhigh' | 'max'
398+ modelSelection ?: ModelSelection
391399 desktopLocalFilesystem ?: boolean
392400 browser ?: boolean
393401 terminalCapable ?: boolean
@@ -709,6 +717,7 @@ async function resolveBranch(params: {
709717 userPermission : payloadParams . userPermission ,
710718 userTimezone : payloadParams . userTimezone ,
711719 effort : payloadParams . effort ,
720+ modelSelection : payloadParams . modelSelection ,
712721 desktopLocalFilesystem : payloadParams . desktopLocalFilesystem ,
713722 browser : payloadParams . browser ,
714723 terminalCapable : payloadParams . terminalCapable ,
@@ -770,6 +779,7 @@ async function resolveBranch(params: {
770779 userPermission : payloadParams . userPermission ,
771780 userTimezone : payloadParams . userTimezone ,
772781 effort : payloadParams . effort ,
782+ modelSelection : payloadParams . modelSelection ,
773783 desktopLocalFilesystem : payloadParams . desktopLocalFilesystem ,
774784 browser : payloadParams . browser ,
775785 terminalCapable : payloadParams . terminalCapable ,
@@ -1233,6 +1243,7 @@ export async function handleUnifiedChatPost(req: NextRequest) {
12331243 userPermission : userPermission ?? undefined ,
12341244 userTimezone : body . userTimezone ,
12351245 effort : body . effort ,
1246+ modelSelection : body . modelSelection ,
12361247 workflowId : branch . workflowId ,
12371248 workflowName : branch . workflowName ,
12381249 workspaceId : branch . workspaceId ,
@@ -1260,6 +1271,7 @@ export async function handleUnifiedChatPost(req: NextRequest) {
12601271 userPermission : userPermission ?? undefined ,
12611272 userTimezone : body . userTimezone ,
12621273 effort : body . effort ,
1274+ modelSelection : body . modelSelection ,
12631275 desktopLocalFilesystem : body . desktopCapabilities ?. localFilesystem === true ,
12641276 browser : body . desktopCapabilities ?. browser === true ,
12651277 terminalCapable : body . desktopCapabilities ?. terminal === true ,
0 commit comments