@@ -39,7 +39,7 @@ function formatAskUserAnswerAsMessage(input, answers) {
3939 * sm, sdk, tm, clients,
4040 * send, sendTo, sendToAdmins, sendToSession, sendToSessionOthers,
4141 * opts, usersModule, userPresence, matesModule, pushModule,
42- * getSessionForWs, getLinuxUserForSession, getOsUserInfoForWs,
42+ * getSessionForWs, getLinuxUserForSession, ensureProjectAccessForSession, getOsUserInfoForWs,
4343 * hydrateImageRefs, onProcessingChanged, broadcastPresence,
4444 * adapter, getProjectList, getProjectCount, getScheduleCount,
4545 * moveScheduleToProject, moveAllSchedulesToProject, getHubSchedules,
@@ -70,6 +70,7 @@ function attachSessions(ctx) {
7070 var pushModule = ctx . pushModule ;
7171 var getSessionForWs = ctx . getSessionForWs ;
7272 var getLinuxUserForSession = ctx . getLinuxUserForSession ;
73+ var ensureProjectAccessForSession = ctx . ensureProjectAccessForSession ;
7374 var getOsUserInfoForWs = ctx . getOsUserInfoForWs ;
7475 var hydrateImageRefs = ctx . hydrateImageRefs ;
7576 var onProcessingChanged = ctx . onProcessingChanged ;
@@ -803,7 +804,7 @@ function attachSessions(ctx) {
803804 session . sentToolResults = { } ;
804805 sendToSession ( session . localId , { type : "status" , status : "processing" } ) ;
805806 if ( ! session . queryInstance && ! session . worker ) {
806- sdk . startQuery ( session , answerText , undefined , getLinuxUserForSession ( session ) ) ;
807+ sdk . startQuery ( session , answerText , undefined , ensureProjectAccessForSession ( session ) ) ;
807808 } else {
808809 sdk . pushMessage ( session , answerText ) ;
809810 }
@@ -932,7 +933,7 @@ function attachSessions(ctx) {
932933 newSession . sentToolResults = { } ;
933934 sendToSession ( newSession . localId , { type : "status" , status : "processing" } ) ;
934935 newSession . acceptEditsAfterStart = true ;
935- sdk . startQuery ( newSession , planPrompt , undefined , getLinuxUserForSession ( newSession ) ) ;
936+ sdk . startQuery ( newSession , planPrompt , undefined , ensureProjectAccessForSession ( newSession ) ) ;
936937 } catch ( e ) {
937938 console . error ( "[project] Error starting plan execution:" , e ) ;
938939 sendTo ( ws , { type : "error" , text : "Failed to start plan execution: " + ( e . message || e ) } ) ;
@@ -963,7 +964,7 @@ function attachSessions(ctx) {
963964 session . sentToolResults = { } ;
964965 sendToSession ( session . localId , { type : "status" , status : "processing" } ) ;
965966 if ( ! session . queryInstance && ! session . worker ) {
966- sdk . startQuery ( session , feedback , undefined , getLinuxUserForSession ( session ) ) ;
967+ sdk . startQuery ( session , feedback , undefined , ensureProjectAccessForSession ( session ) ) ;
967968 } else {
968969 sdk . pushMessage ( session , feedback ) ;
969970 }
0 commit comments