UNPKG

autosnippet

Version:

Extract code patterns into a knowledge base for AI coding assistants

15 lines (14 loc) 609 B
/** * Gateway 中间件 * 为 Express 请求注入 Gateway 执行能力 * 路由层通过 req.gw(action, resource, data) 发起 Gateway 请求 * * actor 来源优先级: * 1. req.resolvedRole — roleResolver 中间件已解析(双路径) * 2. req.headers['x-user-id'] — 内部 / MCP 调用 * 3. 'anonymous' — 兜底 */ import type { NextFunction, Request, Response } from 'express'; /** Express 中间件:将 Gateway 注入到 req 对象 */ export declare function gatewayMiddleware(): (req: Request, _res: Response, next: NextFunction) => void; export default gatewayMiddleware;