@h-ai/kit 0.1.0-alpha5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,618 @@
1
+ import { AuthnOperations } from '@h-ai/iam';
2
+ import { RequestEvent } from '@sveltejs/kit';
3
+ import { T as TransportCryptoServiceLike } from './kit-crypto-types-C-gEvx04.js';
4
+
5
+ /**
6
+ * @h-ai/kit — 速率限制中间件
7
+ *
8
+ * 基于滑动窗口的请求速率限制中间件。
9
+ * 内置内存存储(`MemoryRateLimitStore`),并支持通过 `RateLimitStore` 接入
10
+ * Redis 等外部存储后端。
11
+ * @module kit-ratelimit
12
+ */
13
+
14
+ /**
15
+ * 速率限制存储条目
16
+ */
17
+ interface RateLimitEntry {
18
+ /** 当前窗口内的请求次数 */
19
+ count: number;
20
+ /** 窗口重置时间戳(ms) */
21
+ resetAt: number;
22
+ }
23
+ /**
24
+ * 速率限制存储接口
25
+ *
26
+ * 内置 `MemoryRateLimitStore` 适合单进程开发;
27
+ * 多实例部署需传入基于 Redis / @h-ai/cache 的分布式实现。
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * // 自定义 Redis 存储
32
+ * const redisStore: RateLimitStore = {
33
+ * async get(key) { ... },
34
+ * async set(key, entry) { ... },
35
+ * async delete(key) { ... },
36
+ * }
37
+ * kit.middleware.rateLimit({ windowMs: 60_000, maxRequests: 100, store: redisStore })
38
+ * ```
39
+ */
40
+ interface RateLimitStore {
41
+ /** 获取指定 key 的限流条目 */
42
+ get: (key: string) => Promise<RateLimitEntry | undefined> | RateLimitEntry | undefined;
43
+ /** 设置限流条目 */
44
+ set: (key: string, entry: RateLimitEntry) => Promise<void> | void;
45
+ /** 删除指定 key 的限流条目 */
46
+ delete: (key: string) => Promise<void> | void;
47
+ /**
48
+ * 原子自增并返回当前计数和重置时间
49
+ *
50
+ * 实现时必须保证 get→increment→set 操作的原子性,
51
+ * 防止并发请求在窗口切换时产生竞态绕过限流。
52
+ * 若未实现,则退回非原子 get+set 流程。
53
+ *
54
+ * @param key - 限流键
55
+ * @param windowMs - 窗口时长(ms)
56
+ * @returns 自增后的计数和窗口重置时间
57
+ */
58
+ increment?: (key: string, windowMs: number) => Promise<RateLimitEntry> | RateLimitEntry;
59
+ }
60
+ /**
61
+ * 内存速率限制存储
62
+ *
63
+ * 基于 Map 实现,适合单进程/开发环境。
64
+ * 多实例部署时限流上限会乘以实例数,建议使用分布式 Store。
65
+ */
66
+ declare class MemoryRateLimitStore implements RateLimitStore {
67
+ private store;
68
+ private cleanupTimer;
69
+ /**
70
+ * 启动定期清理过期条目
71
+ *
72
+ * @param intervalMs - 清理间隔(毫秒)
73
+ */
74
+ startCleanup(intervalMs: number): void;
75
+ get(key: string): RateLimitEntry | undefined;
76
+ set(key: string, entry: RateLimitEntry): void;
77
+ delete(key: string): void;
78
+ /**
79
+ * 原子自增(内存实现为同步操作,天然原子)
80
+ *
81
+ * @param key - 限流键
82
+ * @param windowMs - 窗口时长
83
+ * @returns 自增后的条目
84
+ */
85
+ increment(key: string, windowMs: number): RateLimitEntry;
86
+ }
87
+ /**
88
+ * 创建速率限制中间件
89
+ *
90
+ * 基于可插拔存储的滑动窗口限流:
91
+ * - 超限时返回 429,并在响应头中告知重置时间
92
+ * - 正常响应附带 `X-RateLimit-*` 头
93
+ * - 默认使用内存存储(单进程),可传入 `store` 实现分布式限流
94
+ *
95
+ * @param config - 限流配置
96
+ * @returns Middleware 实例
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * middleware: [
101
+ * kit.middleware.rateLimit({ windowMs: 60_000, maxRequests: 100 }),
102
+ * ]
103
+ * ```
104
+ */
105
+ declare function rateLimitMiddleware(config: RateLimitConfig): Middleware;
106
+
107
+ /**
108
+ * @h-ai/kit — 类型定义
109
+ *
110
+ * SvelteKit 集成相关类型
111
+ * @module kit-types
112
+ */
113
+
114
+ /**
115
+ * kit.auth 认证操作(由 createHandle auth.operations 注入)
116
+ *
117
+ * 注入后,kit.auth.login / kit.auth.logout 等函数自动委托到 iam.auth 对应方法。
118
+ * 传入 `iam.auth` 即可,kit 会自动提取所需方法。
119
+ */
120
+ type AuthOperations = Pick<AuthnOperations, 'login' | 'loginWithOtp' | 'loginWithLdap' | 'loginWithApiKey' | 'registerAndLogin' | 'logout'>;
121
+ /** 认证操作提供器:支持直接传对象或按需返回最新对象的工厂函数 */
122
+ type AuthOperationsProvider = AuthOperations | (() => AuthOperations);
123
+ /**
124
+ * 会话数据最小接口
125
+ *
126
+ * 守卫和权限检查函数所需的最小会话形状。
127
+ * 应用层扩展的 session(如添加 displayName / avatarUrl 等字段)
128
+ * 只要包含此接口的字段即可直接传入守卫函数,无需类型断言。
129
+ */
130
+ interface SessionLike {
131
+ /** 用户 ID */
132
+ userId: string;
133
+ /** 角色列表 */
134
+ roles: string[];
135
+ /** 权限列表 */
136
+ permissions: string[];
137
+ /** 允许任意扩展字段 */
138
+ [key: string]: unknown;
139
+ }
140
+ /**
141
+ * 用户会话数据
142
+ *
143
+ * 在 Handle Hook 中通过 `validateSession` 解析后注入 `event.locals.session`。
144
+ * 守卫和中间件通过此结构判断用户身份、角色与权限。
145
+ *
146
+ * 应用层可通过 `& { displayName: string }` 等方式扩展,
147
+ * 扩展后的类型自动兼容所有守卫和权限检查函数(它们接受 `SessionLike`)。
148
+ *
149
+ * @example
150
+ * ```ts
151
+ * const session: SessionData = {
152
+ * userId: 'u_123',
153
+ * username: 'alice',
154
+ * roles: ['admin'],
155
+ * permissions: ['user:read', 'user:write'],
156
+ * }
157
+ *
158
+ * // 应用层扩展
159
+ * type AppSession = SessionData & { displayName: string, avatarUrl: string }
160
+ * ```
161
+ */
162
+ interface SessionData {
163
+ /** 用户 ID */
164
+ userId: string;
165
+ /** 用户名 */
166
+ username?: string;
167
+ /** 角色列表 */
168
+ roles: string[];
169
+ /** 权限列表 */
170
+ permissions: string[];
171
+ /** 自定义数据 */
172
+ data?: Record<string, unknown>;
173
+ /** 允许任意扩展字段 */
174
+ [key: string]: unknown;
175
+ }
176
+ /**
177
+ * 扩展的请求事件
178
+ *
179
+ * 在 SvelteKit 原生 `RequestEvent` 基础上注入会话和请求 ID。
180
+ */
181
+ interface HaiRequestEvent extends RequestEvent {
182
+ /** 会话数据 */
183
+ session?: SessionData;
184
+ /** 请求 ID */
185
+ requestId: string;
186
+ }
187
+ /**
188
+ * 中间件上下文
189
+ *
190
+ * 由 `createHandle` 构建,传递给所有中间件函数。
191
+ * 包含当前请求事件、已解析的会话以及请求唯一 ID。
192
+ */
193
+ interface MiddlewareContext {
194
+ /** 请求事件 */
195
+ event: RequestEvent;
196
+ /** 会话数据 */
197
+ session?: SessionData;
198
+ /** 请求 ID */
199
+ requestId: string;
200
+ }
201
+ /**
202
+ * 中间件函数
203
+ *
204
+ * 遵循洋葱模型:调用 `next()` 前执行前置逻辑,调用后执行后置逻辑。
205
+ *
206
+ * @example
207
+ * ```ts
208
+ * const timing: Middleware = async (ctx, next) => {
209
+ * const start = Date.now()
210
+ * const response = await next()
211
+ * response.headers.set('X-Duration', `${Date.now() - start}ms`)
212
+ * return response
213
+ * }
214
+ * ```
215
+ */
216
+ type Middleware = (context: MiddlewareContext, next: () => Promise<Response>) => Promise<Response>;
217
+ /**
218
+ * 路由守卫结果
219
+ *
220
+ * 守卫函数必须返回此结构。`allowed: true` 表示放行,否则根据
221
+ * `redirect` / `message` / `status` 决定拦截行为。
222
+ */
223
+ interface GuardResult {
224
+ /** 是否允许访问 */
225
+ allowed: boolean;
226
+ /** 重定向 URL(拒绝时) */
227
+ redirect?: string;
228
+ /** 错误消息(拒绝时) */
229
+ message?: string;
230
+ /** HTTP 状态码 */
231
+ status?: number;
232
+ }
233
+ /**
234
+ * 路由守卫函数
235
+ *
236
+ * 接收请求事件与可选会话,返回 `GuardResult`(同步或异步均可)。
237
+ *
238
+ * @example
239
+ * ```ts
240
+ * const myGuard: RouteGuard = (event, session) => {
241
+ * if (!session) return { allowed: false, status: 401 }
242
+ * return { allowed: true }
243
+ * }
244
+ * ```
245
+ */
246
+ type RouteGuard = (event: RequestEvent, session?: SessionData) => Promise<GuardResult> | GuardResult;
247
+ /**
248
+ * 守卫配置
249
+ *
250
+ * 在 `createHandle({ guards })` 中使用。
251
+ * `paths` 支持 `/*` 和 `/**` 通配符,`exclude` 优先于 `paths`。
252
+ *
253
+ * @example
254
+ * ```ts
255
+ * const config: GuardConfig = {
256
+ * guard: kit.guard.auth({ apiMode: true }),
257
+ * paths: ['/api/*'],
258
+ * exclude: ['/api/health'],
259
+ * }
260
+ * ```
261
+ */
262
+ interface GuardConfig {
263
+ /** 守卫函数 */
264
+ guard: RouteGuard;
265
+ /** 适用路径(glob 模式) */
266
+ paths?: string[];
267
+ /** 排除路径 */
268
+ exclude?: string[];
269
+ }
270
+ /**
271
+ * 认证配置
272
+ *
273
+ * 在 `HandleConfig.auth` 中使用,自动完成:
274
+ * 1. 从 Bearer header / Cookie 提取 Token
275
+ * 2. 调用 verifyToken 恢复会话
276
+ * 3. 根据 protectedPaths / publicPaths 自动生成路由守卫
277
+ *
278
+ * API 路径(以 `/api/` 开头)未认证时返回 401 JSON;
279
+ * 非 API 路径未认证时重定向到 `loginUrl`(若配置)或返回 401。
280
+ *
281
+ * @example
282
+ * ```ts
283
+ * kit.createHandle({
284
+ * auth: {
285
+ * verifyToken: validateSession,
286
+ * loginUrl: '/auth/login',
287
+ * protectedPaths: ['/admin/*', '/api/*'],
288
+ * publicPaths: ['/api/auth/*', '/api/public/*'],
289
+ * },
290
+ * })
291
+ * ```
292
+ */
293
+ interface HandleAuthConfig {
294
+ /** 令牌验证函数,返回 SessionData 或 null */
295
+ verifyToken: (token: string) => Promise<SessionData | null>;
296
+ /**
297
+ * 认证操作。
298
+ *
299
+ * - 直接对象:`operations: iam.auth`
300
+ * - 工厂函数:`operations: () => iam.auth`(推荐,避免模块加载阶段捕获旧引用)
301
+ */
302
+ operations?: AuthOperationsProvider;
303
+ /** 未认证时 UI 路由重定向地址(如 `'/auth/login'`) */
304
+ loginUrl?: string;
305
+ /** Token Cookie 名(默认 `'hai_access_token'`) */
306
+ cookieName?: string;
307
+ /** 需要认证的路径(支持 `/*` `/**` 通配符) */
308
+ protectedPaths?: string[];
309
+ /** 免认证的路径(优先于 protectedPaths) */
310
+ publicPaths?: string[];
311
+ }
312
+ /**
313
+ * Handle Hook 配置
314
+ *
315
+ * 传给 `kit.createHandle()` 的配置。
316
+ *
317
+ * 自动完成:
318
+ * 1. 生成 requestId 并注入 `event.locals`
319
+ * 2. 根据 `auth` 配置解析会话
320
+ * 3. 执行路由守卫
321
+ * 4. 执行中间件链(logging / rateLimit / 自定义)
322
+ * 5. 调用 resolve + 附加 `X-Request-Id` 响应头
323
+ *
324
+ * @example
325
+ * ```ts
326
+ * kit.createHandle({
327
+ * auth: {
328
+ * verifyToken: validateSession,
329
+ * loginUrl: '/auth/login',
330
+ * protectedPaths: ['/admin/*', '/api/*'],
331
+ * publicPaths: ['/api/auth/*'],
332
+ * },
333
+ * rateLimit: { maxRequests: 100 },
334
+ * crypto: { crypto, transport: true },
335
+ * })
336
+ * ```
337
+ */
338
+ interface HandleConfig {
339
+ /**
340
+ * 认证配置
341
+ *
342
+ * 提供后自动完成 Token 解析、会话恢复、路由守卫等。
343
+ * 不提供则不做认证处理。
344
+ */
345
+ auth?: HandleAuthConfig;
346
+ /**
347
+ * 速率限制配置
348
+ *
349
+ * 提供对象启用速率限制;设为 `false` 显式禁用。
350
+ * 不提供则不开启速率限制。
351
+ */
352
+ rateLimit?: {
353
+ windowMs?: number;
354
+ maxRequests?: number;
355
+ } | false;
356
+ /**
357
+ * 请求日志配置
358
+ *
359
+ * - `true`(默认):启用日志中间件
360
+ * - `{ logBody: true }`:启用并记录请求体
361
+ * - `false`:禁用日志
362
+ */
363
+ logging?: boolean | {
364
+ logBody?: boolean;
365
+ };
366
+ /**
367
+ * 加密配置(传输加密 + Cookie 加密)
368
+ *
369
+ * 启用后 kit 自动在 Handle 中完成:
370
+ * - 传输加密:请求体解密 / 响应体加密 / 密钥交换端点
371
+ * - Cookie 加密:对指定 Cookie 的 get/set 自动 AES 加解密
372
+ */
373
+ crypto?: HookCryptoConfig;
374
+ /** 自定义错误处理(不提供则使用内置的 500 JSON 响应) */
375
+ onError?: (error: unknown, event: RequestEvent) => Response | Promise<Response>;
376
+ /** 自定义守卫(在 auth 自动守卫之后执行) */
377
+ guards?: GuardConfig[];
378
+ /** 自定义中间件(在内置 logging / rateLimit 之后执行) */
379
+ middleware?: Middleware[];
380
+ /**
381
+ * A2A 协议集成
382
+ *
383
+ * 传入 `ai.a2a` 操作对象后,自动挂载 Agent Card 发现端点和 JSON-RPC 处理端点。
384
+ *
385
+ * - 简单模式:`a2a: ai.a2a`(使用默认路径)
386
+ * - 配置模式:`a2a: { operations: ai.a2a, rpcPath: '/api/a2a' }`
387
+ */
388
+ a2a?: HandleA2AOperations | HandleA2AConfig;
389
+ }
390
+ /**
391
+ * A2A 操作接口(用于 Handle 集成)
392
+ *
393
+ * 与 `ai.a2a` 结构兼容,可直接传入 `ai.a2a` 对象。
394
+ */
395
+ interface HandleA2AOperations {
396
+ /** 获取 Agent Card(返回 HaiResult 对象) */
397
+ getAgentCard: () => {
398
+ success: boolean;
399
+ data?: unknown;
400
+ error?: unknown;
401
+ };
402
+ /** 处理 JSON-RPC 请求 */
403
+ handleRequest: (body: unknown, context?: Record<string, unknown>) => Promise<{
404
+ streaming: boolean;
405
+ body?: unknown;
406
+ stream?: AsyncGenerator<unknown, void, undefined>;
407
+ }>;
408
+ }
409
+ /**
410
+ * A2A Handle 配置(高级模式)
411
+ *
412
+ * @example
413
+ * ```ts
414
+ * kit.createHandle({
415
+ * a2a: {
416
+ * operations: ai.a2a,
417
+ * rpcPath: '/api/a2a',
418
+ * authenticate: 'apiKey', // 自动使用 IAM API Key 验证
419
+ * },
420
+ * })
421
+ * ```
422
+ */
423
+ interface HandleA2AConfig {
424
+ /** A2A 操作接口(通常传入 `ai.a2a`) */
425
+ operations: HandleA2AOperations;
426
+ /** Agent Card 端点路径(默认 `/.well-known/agent.json`) */
427
+ cardPath?: string;
428
+ /** JSON-RPC 端点路径(默认 `/a2a`) */
429
+ rpcPath?: string;
430
+ /**
431
+ * A2A 认证
432
+ *
433
+ * - `'apiKey'`:自动使用 IAM API Key 认证(根据 Agent Card 的 security 配置提取 key)
434
+ * - 函数:自定义认证回调
435
+ */
436
+ authenticate?: 'apiKey' | ((event: RequestEvent) => Promise<Record<string, unknown> | null | undefined>);
437
+ }
438
+ /**
439
+ * 传输加密详细配置
440
+ */
441
+ interface TransportEncryptionOptions {
442
+ /** 密钥交换端点路径(默认 `'/api/kit/key-exchange'`) */
443
+ keyExchangePath?: string;
444
+ /** 排除路径(不加密),支持精确匹配和前缀匹配 */
445
+ excludePaths?: string[];
446
+ /**
447
+ * 是否强制要求传输加密(默认 `true`)
448
+ *
449
+ * - `true`:非排除路径上缺少 X-Client-Id 请求头时返回 400
450
+ * - `false`:缺少 X-Client-Id 时透传明文(渐进式迁移)
451
+ */
452
+ requireEncryption?: boolean;
453
+ /** 是否加密响应体(默认 `true`) */
454
+ encryptResponse?: boolean;
455
+ }
456
+ /**
457
+ * Handle Hook 加密配置
458
+ *
459
+ * 在 `kit.createHandle({ crypto: { ... } })` 中使用。
460
+ *
461
+ * @example
462
+ * ```ts
463
+ * kit.createHandle({
464
+ * crypto: {
465
+ * crypto: cryptoInstance,
466
+ * transport: true,
467
+ * encryptedCookies: ['hai_session'],
468
+ * cookieEncryptionKey: process.env.HAI_KIT_COOKIE_KEY,
469
+ * },
470
+ * })
471
+ * ```
472
+ */
473
+ interface HookCryptoConfig {
474
+ /** 注入 @h-ai/crypto 实例(传输加密所需的非对称 + 对称子集) */
475
+ crypto: TransportCryptoServiceLike;
476
+ /**
477
+ * 启用传输加密。
478
+ * - `true`:使用默认配置
479
+ * - 对象:自定义配置
480
+ */
481
+ transport?: boolean | TransportEncryptionOptions;
482
+ /**
483
+ * 需要加密的 Cookie 名称列表
484
+ *
485
+ * 列出的 Cookie 在 set 时自动 SM4-CBC 加密,get 时自动解密。
486
+ */
487
+ encryptedCookies?: string[];
488
+ /**
489
+ * Cookie 加密密钥(32 字符十六进制 = 16 字节 SM4 密钥)
490
+ *
491
+ * 如不提供,则从环境变量 `HAI_KIT_COOKIE_KEY` 读取。
492
+ * 两者都未设置时 Cookie 加密不生效并输出警告。
493
+ */
494
+ cookieEncryptionKey?: string;
495
+ }
496
+ /**
497
+ * API 响应包装
498
+ *
499
+ * `kit.response.*` 系列函数统一返回此结构的 JSON 响应。
500
+ * 成功时 `success: true` 且 `data` 有值;失败时 `success: false` 且 `error` 有值。
501
+ *
502
+ * @example
503
+ * ```ts
504
+ * // 成功
505
+ * { success: true, data: { id: '1' }, requestId: 'req_abc' }
506
+ * // 失败
507
+ * { success: false, error: { code: 'NOT_FOUND', message: 'Resource not found' } }
508
+ * ```
509
+ */
510
+ interface ApiResponse<T = unknown> {
511
+ /** 是否成功 */
512
+ success: boolean;
513
+ /** 数据 */
514
+ data?: T;
515
+ /** 错误信息 */
516
+ error?: {
517
+ code: string;
518
+ message: string;
519
+ details?: unknown;
520
+ };
521
+ /** 请求 ID */
522
+ requestId?: string;
523
+ }
524
+ /**
525
+ * 表单验证错误
526
+ *
527
+ * 由 `kit.validate.*` 在校验失败时返回。
528
+ * `field` 使用点号路径(如 `'address.city'`),`_` 表示全局错误。
529
+ */
530
+ interface FormError {
531
+ /** 字段名 */
532
+ field: string;
533
+ /** 错误消息 */
534
+ message: string;
535
+ }
536
+ /**
537
+ * 表单验证结果
538
+ *
539
+ * @template T - Zod schema 推导出的数据类型
540
+ *
541
+ * @example
542
+ * ```ts
543
+ * const { valid, data, errors } = await kit.validate.form(request, schema)
544
+ * if (!valid) return kit.response.validationError(errors)
545
+ * // data 此时类型安全
546
+ * ```
547
+ */
548
+ interface FormValidationResult<T> {
549
+ /** 是否有效 */
550
+ valid: boolean;
551
+ /** 解析后的数据 */
552
+ data?: T;
553
+ /** 错误列表 */
554
+ errors: FormError[];
555
+ }
556
+ /**
557
+ * 速率限制配置
558
+ *
559
+ * 基于可插拔存储的滑动窗口限流。超限后返回 429 状态码与 `Retry-After` 响应头。
560
+ * 默认使用内存存储(单进程),多实例部署请传入分布式 `store` 实现。
561
+ *
562
+ * @example
563
+ * ```ts
564
+ * kit.middleware.rateLimit({
565
+ * windowMs: 60_000, // 1 分钟
566
+ * maxRequests: 100, // 最多 100 次
567
+ * })
568
+ * ```
569
+ */
570
+ interface RateLimitConfig {
571
+ /** 时间窗口 (ms) */
572
+ windowMs: number;
573
+ /** 最大请求数 */
574
+ maxRequests: number;
575
+ /** 自定义 key 生成 */
576
+ keyGenerator?: (event: RequestEvent) => string;
577
+ /** 超限处理 */
578
+ onLimitReached?: (event: RequestEvent) => Response;
579
+ /**
580
+ * 自定义存储实现
581
+ *
582
+ * 默认使用 `MemoryRateLimitStore`(单进程)。
583
+ * 多实例部署时传入基于 Redis / @h-ai/cache 的分布式 Store。
584
+ */
585
+ store?: RateLimitStore;
586
+ }
587
+ /**
588
+ * CORS 中间件配置
589
+ *
590
+ * 配置跨域资源共享策略。预检请求(OPTIONS)自动返回 204。
591
+ *
592
+ * @example
593
+ * ```ts
594
+ * kit.middleware.cors({
595
+ * origin: ['https://example.com'],
596
+ * credentials: true,
597
+ * maxAge: 86400,
598
+ * })
599
+ * ```
600
+ */
601
+ interface CorsConfig {
602
+ /** 允许的源(支持通配符,如 `*.example.com`) */
603
+ origin?: string | string[] | ((origin: string) => boolean);
604
+ /** 允许的方法 */
605
+ methods?: string[];
606
+ /** 允许的头 */
607
+ allowedHeaders?: string[];
608
+ /** 暴露的头 */
609
+ exposedHeaders?: string[];
610
+ /** 是否允许凭证 */
611
+ credentials?: boolean;
612
+ /** 预检缓存时间 (秒) */
613
+ maxAge?: number;
614
+ /** 是否自动允许 Capacitor WebView origin(默认 true) */
615
+ capacitor?: boolean;
616
+ }
617
+
618
+ export { type ApiResponse as A, type CorsConfig as C, type FormError as F, type GuardConfig as G, type HaiRequestEvent as H, type Middleware as M, type RateLimitConfig as R, type SessionData as S, type TransportEncryptionOptions as T, type AuthOperations as a, type AuthOperationsProvider as b, type FormValidationResult as c, type GuardResult as d, type HandleA2AConfig as e, type HandleA2AOperations as f, type HandleAuthConfig as g, type HandleConfig as h, type HookCryptoConfig as i, type MiddlewareContext as j, type RouteGuard as k, type SessionLike as l, MemoryRateLimitStore as m, type RateLimitEntry as n, type RateLimitStore as o, rateLimitMiddleware as r };