Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
refactor(mcp-host): name the sessions/messages limit caps (R1-M2)
Diego Zacarias97696e13ceda
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.jsonindex 74810f066..464458eeb 100644--- a/mcp-host/package-lock.json+++ b/mcp-host/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-mcp-host",- "version": "0.1.228",+ "version": "0.1.229","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-mcp-host",- "version": "0.1.228",+ "version": "0.1.229","license": "SEE LICENSE IN LICENSE","dependencies": {"@anthropic-ai/sdk": "^0.32.0",diff --git a/mcp-host/package.json b/mcp-host/package.jsonindex 46b92f93b..9164dc62a 100644--- a/mcp-host/package.json+++ b/mcp-host/package.json@@ -1,6 +1,6 @@{"name": "clerum-mcp-host",- "version": "0.1.228",+ "version": "0.1.229","description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude","main": "dist/main.js","engines": {diff --git a/mcp-host/src/server/routes.ts b/mcp-host/src/server/routes.tsindex 38308df64..dbe368d3e 100644--- a/mcp-host/src/server/routes.ts+++ b/mcp-host/src/server/routes.ts@@ -67,8 +67,7 @@ export type RouteHandlers = {function isSessionOwnershipError(error: unknown): boolean {return (- error instanceof ConversationError &&- error.code === ConversationErrorCode.OwnershipMismatch+ error instanceof ConversationError && error.code === ConversationErrorCode.OwnershipMismatch)}@@ -92,6 +91,12 @@ function hasBracketedQueryVariant(query: Request['query'], names: string[]): booreturn Object.keys(query).some(key => names.some(name => key.startsWith(`${name}[`)))}+// Server-side hard caps on client-supplied page sizes. The proxy applies its+// own caps at the edge; these are the host's independent enforcement (the two+// services share no package, so each names its own constants).+const SESSIONS_LIMIT_CAP = 100+const MESSAGES_LIMIT_CAP = 200+function isSafeRouteSegment(value: string): boolean {return (value.length > 0 &&@@ -1163,7 +1168,8 @@ export async function handleSessionsListRoute(json(res, 501, { error: 'Sessions handler not configured' })return}- const limit = rawLimit === undefined ? (cursor ? 50 : undefined) : Math.min(rawLimit, 100)+ const limit =+ rawLimit === undefined ? (cursor ? 50 : undefined) : Math.min(rawLimit, SESSIONS_LIMIT_CAP)const result = await handlers.sessionsListHandler(caller.userId, { agent, limit, cursor })json(res, 200, result)} catch (error) {@@ -1284,7 +1290,7 @@ export async function handleSessionMessagesRoute(? rawBeforeTurn !== undefined || rawAfterTurn !== undefined? 80: undefined- : Math.min(rawLimit, 200)+ : Math.min(rawLimit, MESSAGES_LIMIT_CAP)const beforeTurn = rawBeforeTurnconst afterTurn = rawAfterTurnconst result = await handlers.sessionMessagesHandler(caller.userId, agent, chatId, {