feat(research): cut over canonical runtime and enforce agent budgets
This commit is contained in:
parent
ab08db82fd
commit
bbf0dd4453
103 changed files with 6138 additions and 3112 deletions
|
|
@ -7,6 +7,7 @@ import { Hono } from 'hono';
|
|||
import { cors } from 'hono/cors';
|
||||
import { createHttpSecurity, httpSecurityOptions, type HttpSecurity } from '@stock-bot/di';
|
||||
import type { IServiceContainer } from '@stock-bot/handlers';
|
||||
import { ResearchAgentsService } from '../services/research-agents.service';
|
||||
import { createBacktestRoutes } from './backtest.routes';
|
||||
import { createBacktestV2Routes } from './backtests-v2.routes';
|
||||
import { createDatasetRoutes } from './datasets.routes';
|
||||
|
|
@ -15,6 +16,7 @@ import { createExperimentRoutes } from './experiments.routes';
|
|||
import { createHealthRoutes } from './health.routes';
|
||||
import { createMonitoringRoutes } from './monitoring.routes';
|
||||
import { createPipelineRoutes } from './pipeline.routes';
|
||||
import { createResearchAgentRoutes } from './research-agents.routes';
|
||||
import { createResearchRoutes } from './research.routes';
|
||||
import { createStrategyRoutes } from './strategies.routes';
|
||||
|
||||
|
|
@ -22,10 +24,15 @@ import { createStrategyRoutes } from './strategies.routes';
|
|||
// the old 1 MiB restriction; normalizers still validate every submitted record.
|
||||
export const WEB_API_MAX_REQUEST_BODY_SIZE = Number.MAX_SAFE_INTEGER;
|
||||
|
||||
export function createRoutes(
|
||||
container: IServiceContainer,
|
||||
security: HttpSecurity = createHttpSecurity({ ...httpSecurityOptions(), browserSessions: true })
|
||||
): Hono {
|
||||
export function createRoutes(container: IServiceContainer, suppliedSecurity?: HttpSecurity): Hono {
|
||||
const agents = new ResearchAgentsService(container);
|
||||
const security =
|
||||
suppliedSecurity ??
|
||||
createHttpSecurity({
|
||||
...httpSecurityOptions(),
|
||||
browserSessions: true,
|
||||
resolveResearchCredential: request => agents.authenticate(request),
|
||||
});
|
||||
const app = new Hono();
|
||||
|
||||
// Add CORS middleware
|
||||
|
|
@ -58,6 +65,7 @@ export function createRoutes(
|
|||
app.route('/', createDatasetRoutes(container));
|
||||
app.route('/', createStrategyRoutes(container));
|
||||
app.route('/', createResearchRoutes(container));
|
||||
app.route('/', createResearchAgentRoutes(container, security.researchEnabled));
|
||||
app.route('/', createExperimentRoutes(container));
|
||||
|
||||
return app;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue