import { createHttpSecurity, httpSecurityOptions, type HttpSecurityOptions } from '@stock-bot/di'; import type { IServiceContainer } from '@stock-bot/services'; import { ResearchAgentsService } from './services/research-agents.service'; /** The web server shares this security instance between HTTP and WebSocket routes. */ export function createWebApiSecurity( container: IServiceContainer, options: HttpSecurityOptions = httpSecurityOptions() ) { const agents = new ResearchAgentsService(container); return createHttpSecurity({ ...options, browserSessions: true, resolveResearchCredential: request => agents.authenticate(request), }); }