@@ -16,7 +16,7 @@ import { requestExplicitStreamAbort } from '@/lib/copilot/request/session/explic
1616import type { StreamEvent } from '@/lib/copilot/request/types'
1717import { isE2BDocEnabled } from '@/lib/core/config/feature-flags'
1818import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
19- import { buildMothershipToolsForRequest } from '@/lib/mothership/settings/runtime '
19+ import { buildUserSkillTool } from '@/lib/mothership/skills '
2020import {
2121 assertActiveWorkspaceAccess ,
2222 getUserEntityPermissions ,
@@ -118,13 +118,12 @@ export const POST = withRouteHandler(async (req: NextRequest) => {
118118 workflowId,
119119 executionId,
120120 } )
121- const [ workspaceContext , integrationTools , mothershipToolRuntime , userPermission ] =
122- await Promise . all ( [
123- generateWorkspaceContext ( workspaceId , userId ) ,
124- buildIntegrationToolSchemas ( userId , messageId , undefined , workspaceId ) ,
125- buildMothershipToolsForRequest ( { workspaceId, userId } ) ,
126- getUserEntityPermissions ( userId , 'workspace' , workspaceId ) . catch ( ( ) => null ) ,
127- ] )
121+ const [ workspaceContext , integrationTools , userSkillTool , userPermission ] = await Promise . all ( [
122+ generateWorkspaceContext ( workspaceId , userId ) ,
123+ buildIntegrationToolSchemas ( userId , messageId , undefined , workspaceId ) ,
124+ buildUserSkillTool ( workspaceId ) ,
125+ getUserEntityPermissions ( userId , 'workspace' , workspaceId ) . catch ( ( ) => null ) ,
126+ ] )
128127 const requestPayload : Record < string , unknown > = {
129128 messages,
130129 responseFormat,
@@ -138,9 +137,7 @@ export const POST = withRouteHandler(async (req: NextRequest) => {
138137 ...( userMetadata ? { userMetadata } : { } ) ,
139138 ...( fileAttachments && fileAttachments . length > 0 ? { fileAttachments } : { } ) ,
140139 ...( integrationTools . length > 0 ? { integrationTools } : { } ) ,
141- ...( mothershipToolRuntime . tools . length > 0
142- ? { mothershipTools : mothershipToolRuntime . tools }
143- : { } ) ,
140+ ...( userSkillTool ? { mothershipTools : [ userSkillTool ] } : { } ) ,
144141 ...( userPermission ? { userPermission } : { } ) ,
145142 }
146143
0 commit comments