@h-ai/kit 0.1.0-alpha.68 → 0.1.0-alpha.70

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.
package/dist/index.d.ts CHANGED
@@ -1,21 +1,22 @@
1
- import { c as createKitClient, a as createKitAuthActions, i as installBrowserTransport, b as installBrowserTransportFetch, o as login, p as loginWithOtp, q as loginWithLdap, t as loginWithApiKey, u as registerAndLogin, v as logout, s as setBrowserToken, d as clearBrowserToken } from './kit-client-auth-HnZIYUia.js';
2
- export { C as ClientTransportConfig, K as KitClient, e as KitClientConfig, f as KitConfig, g as KitConfigInput, h as KitConfigSchema, j as KitServerConfig, k as KitServerConfigInput, l as KitTransportConfig, m as KitTransportConfigInput, r as resolveKitConfig, n as resolveKitTransportConfig } from './kit-client-auth-HnZIYUia.js';
1
+ import { c as createKitClient, a as createKitAuthActions, i as installBrowserTransport, b as installBrowserTransportFetch, o as login, p as loginWithOtp, q as loginWithLdap, t as loginWithApiKey, u as registerAndLogin, v as logout, s as setBrowserToken, d as clearBrowserToken } from './kit-client-auth-B5y1g5_A.js';
2
+ export { C as ClientTransportConfig, K as KitClient, e as KitClientConfig, f as KitConfig, g as KitConfigInput, h as KitConfigSchema, j as KitServerConfig, k as KitServerConfigInput, l as KitTransportConfig, m as KitTransportConfigInput, r as resolveKitConfig, n as resolveKitTransportConfig } from './kit-client-auth-B5y1g5_A.js';
3
3
  import { d as defineCrud, s as setAllModulesLocale } from './kit-i18n-DEzmzE5T.js';
4
4
  export { C as CrudApiDef, a as CrudFieldDef, b as CrudFieldOption, c as CrudFieldOptions, e as CrudFieldType, f as CrudFieldValidation, g as CrudFilterParams, h as CrudOperations, i as CrudPaginatedResult, j as CrudPaginationParams, k as CrudResourceDef, l as CrudTableColumn, m as CrudText, r as resolveOptions, n as resolveText } from './kit-i18n-DEzmzE5T.js';
5
- import { S as SessionData, l as SessionLike, h as HandleConfig, r as rateLimitMiddleware, m as createCacheRateLimitStore, n as createMemoryRateLimitStore } from './kit-types-CnzhN-AS.js';
6
- export { A as ApiResponse, a as AuthOperations, b as AuthOperationsProvider, C as CorsConfig, F as FormError, c as FormValidationResult, G as GuardConfig, d as GuardResult, H as HaiRequestEvent, e as HandleA2AConfig, f as HandleA2AOperations, g as HandleAuthConfig, i as HookCryptoConfig, o as MemoryRateLimitStore, M as Middleware, j as MiddlewareContext, p as RateLimitCache, R as RateLimitConfig, q as RateLimitEntry, s as RateLimitStore, k as RouteGuard, T as TransportEncryptionOptions } from './kit-types-CnzhN-AS.js';
5
+ import { S as SessionData, l as SessionLike, h as HandleConfig, r as rateLimitMiddleware, m as createCacheRateLimitStore, n as createMemoryRateLimitStore } from './kit-types-DQYqP1Cn.js';
6
+ export { A as ApiResponse, a as AuthOperations, b as AuthOperationsProvider, C as CorsConfig, F as FormError, c as FormValidationResult, G as GuardConfig, d as GuardResult, H as HaiRequestEvent, e as HandleA2AConfig, f as HandleA2AOperations, g as HandleAuthConfig, i as HookCryptoConfig, o as MemoryRateLimitStore, M as Middleware, j as MiddlewareContext, p as RateLimitCache, R as RateLimitConfig, q as RateLimitEntry, s as RateLimitStore, k as RouteGuard, T as TransportEncryptionOptions } from './kit-types-DQYqP1Cn.js';
7
7
  import { CryptoFunctions } from '@h-ai/crypto';
8
8
  export { EncryptedPayload, TransportEncryptionManager, TransportKeyPair } from '@h-ai/crypto';
9
+ import { FeedbackFunctions, FeedbackContext } from '@h-ai/feedback';
10
+ import * as _sveltejs_kit from '@sveltejs/kit';
11
+ import { Handle, RequestEvent, RequestHandler } from '@sveltejs/kit';
9
12
  import * as _h_ai_core from '@h-ai/core';
10
13
  import { HaiError } from '@h-ai/core';
11
14
  import * as zod_v4_core from 'zod/v4/core';
12
15
  import * as zod from 'zod';
13
16
  import { z } from 'zod';
14
- import * as _sveltejs_kit from '@sveltejs/kit';
15
- import { Handle, RequestEvent, RequestHandler } from '@sveltejs/kit';
16
17
  import { IamFunctions } from '@h-ai/iam';
17
- export { A as A2AApiKeyAuthConfig, K as KitA2AHandlerConfig, R as ResolvedA2AConfig } from './kit-a2a-types-CwT1AFQu.js';
18
- export { C as CryptoCsrfConfig, a as CryptoServiceLike, E as EncryptedCookieConfig, T as TransportEncryptionConfig, W as WebhookVerifyConfig } from './kit-crypto-types-Dd24aJ4m.js';
18
+ export { A as A2AApiKeyAuthConfig, K as KitA2AHandlerConfig, R as ResolvedA2AConfig } from './kit-a2a-types-DwcmE668.js';
19
+ export { C as CryptoCsrfConfig, a as CryptoServiceLike, E as EncryptedCookieConfig, T as TransportEncryptionConfig, W as WebhookVerifyConfig } from './kit-crypto-types-Cwj9bprV.js';
19
20
  import '@h-ai/api-contract';
20
21
 
21
22
  /**
@@ -246,6 +247,37 @@ declare function createHandle(config?: HandleConfig): Handle;
246
247
  */
247
248
  declare function sequence(...handles: Handle[]): Handle;
248
249
 
250
+ /** 可直接挂到 SvelteKit catch-all 路由的反馈适配,无 serv 或 Svelte UI 依赖。 */
251
+
252
+ /**
253
+ * 反馈服务及可信范围解析。resolveContext 必须使用已验证 session/宿主策略。
254
+ * @example
255
+ * ```ts
256
+ * import type { FeedbackHandlerOptions } from '@h-ai/kit'
257
+ * import { feedback } from '@h-ai/feedback'
258
+ * const options: FeedbackHandlerOptions = { feedback, resolveContext: () => null }
259
+ * // 应用实现真实 session 映射;null 拒绝访问,不能从 JSON 取得身份。
260
+ * ```
261
+ */
262
+ interface FeedbackHandlerOptions {
263
+ readonly feedback: FeedbackFunctions;
264
+ readonly resolveContext: (event: RequestEvent) => FeedbackContext | null | Promise<FeedbackContext | null>;
265
+ readonly basePath?: string;
266
+ }
267
+ /**
268
+ * 装配反馈 REST 路由;默认路径 /api/feedback,由宿主 handle 保持 CSRF、认证和传输加密。
269
+ * @param options - 已初始化服务与可信范围映射。
270
+ * @returns 可赋值给 catch-all 路由 GET/POST/PATCH 的同一 handler。
271
+ * @example
272
+ * ```ts
273
+ * import { kit } from '@h-ai/kit'
274
+ * import { feedback } from '@h-ai/feedback'
275
+ * const handler = kit.createFeedbackHandler({ feedback, resolveContext: () => null })
276
+ * // 路由 export const GET = handler;真实应用从受信 session 返回范围,null 默认拒绝。
277
+ * ```
278
+ */
279
+ declare function createFeedbackHandler(options: FeedbackHandlerOptions): RequestHandler;
280
+
249
281
  /**
250
282
  * 应用路由直接导出对应 handler;认证 ops 仍由 createHandle 注入。
251
283
  * @param iam - 已由应用初始化的 IAM 服务对象。
@@ -649,6 +681,8 @@ declare const PaginationQuerySchema: z.ZodObject<{
649
681
  * ```
650
682
  */
651
683
  declare const kit: {
684
+ /** 创建反馈的受控 catch-all HTTP handler,身份范围由宿主解析。 */
685
+ createFeedbackHandler: typeof createFeedbackHandler;
652
686
  /** 原子限流工厂;共享store生命周期由应用管理。 */
653
687
  middleware: {
654
688
  rateLimit: typeof rateLimitMiddleware;
@@ -789,4 +823,4 @@ interface LoggingMiddlewareConfig {
789
823
  redactFields?: string[];
790
824
  }
791
825
 
792
- export { type AuthGuardConfig, type CookieProxyConfig, HandleConfig, IdParamSchema, type LoggingMiddlewareConfig, PaginationQuerySchema, type PermissionGuardConfig, type RoleGuardConfig, SessionData, type SessionGuardConfig, SessionLike, defineCrud, kit, matchPermission };
826
+ export { type AuthGuardConfig, type CookieProxyConfig, type FeedbackHandlerOptions, HandleConfig, IdParamSchema, type LoggingMiddlewareConfig, PaginationQuerySchema, type PermissionGuardConfig, type RoleGuardConfig, SessionData, type SessionGuardConfig, SessionLike, defineCrud, kit, matchPermission };
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
- import { defineCrud } from './chunk-P6XH7G4N.js';
2
- export { KitConfigSchema, defineCrud, resolveKitConfig, resolveKitTransportConfig, resolveOptions, resolveText } from './chunk-P6XH7G4N.js';
3
- import { clearBrowserToken, setBrowserToken, logout, registerAndLogin, loginWithApiKey, loginWithLdap, loginWithOtp, login, installBrowserTransportFetch, installBrowserTransport, createKitAuthActions, createKitClient, configureAuth, getAccessToken } from './chunk-2YYRP7HH.js';
1
+ import { defineCrud } from './chunk-Y2YUA3VR.js';
2
+ export { KitConfigSchema, defineCrud, resolveKitConfig, resolveKitTransportConfig, resolveOptions, resolveText } from './chunk-Y2YUA3VR.js';
3
+ import { clearBrowserToken, setBrowserToken, logout, registerAndLogin, loginWithApiKey, loginWithLdap, loginWithOtp, login, installBrowserTransportFetch, installBrowserTransport, createKitAuthActions, createKitClient, configureAuth, getAccessToken } from './chunk-QNLZLTVC.js';
4
4
  import { resolveA2AConfig, handleA2ARequest } from './chunk-2PWGJCWX.js';
5
- import { transportEncryptionMiddleware } from './chunk-333FGMGQ.js';
5
+ import { transportEncryptionMiddleware } from './chunk-UTCS6FR7.js';
6
6
  import './chunk-XC7I2L3G.js';
7
7
  import { kitM, setAllModulesLocale } from './chunk-OVRZIDCD.js';
8
- import { core } from '@h-ai/core';
8
+ import { core, HaiCommonError } from '@h-ai/core';
9
9
  import { createHash } from 'crypto';
10
10
  import { isIP } from 'net';
11
11
  import process2 from 'process';
12
- import { IamConfirmPasswordResetInputSchema, IamRequestPasswordResetInputSchema, IamSendOtpInputSchema, IamRegisterInputSchema, IamOtpLoginInputSchema, IamLdapLoginInputSchema, IamLoginInputSchema } from '@h-ai/api-contract';
12
+ import { IamConfirmPasswordResetInputSchema, IamRequestPasswordResetInputSchema, IamSendOtpInputSchema, IamRegisterInputSchema, IamOtpLoginInputSchema, IamLdapLoginInputSchema, IamLoginInputSchema, FeedbackSubmitInputSchema, FeedbackListInputSchema, FeedbackIdInputSchema, FeedbackEvidenceQuerySchema, FeedbackAppendEvidenceInputSchema, FeedbackSetStatusInputSchema, FeedbackRetryInputSchema, FeedbackCompleteInputSchema, FeedbackExportInputSchema, FeedbackUploadInputSchema, FeedbackAttachmentQuerySchema, FeedbackExportQuerySchema } from '@h-ai/api-contract';
13
13
  import { z } from 'zod';
14
14
 
15
15
  // src/guards/kit-permission.ts
@@ -380,99 +380,104 @@ function createHandle(config = {}) {
380
380
  const transportMiddleware = buildTransportMiddleware(cryptoConfig);
381
381
  const cookieProxyConfig = buildCookieProxyConfig(cryptoConfig);
382
382
  return async ({ event, resolve }) => {
383
- const requestId = generateId("req");
384
- const context = {
385
- event,
386
- requestId
387
- };
388
- const locals = event.locals;
389
- locals.requestId = requestId;
390
- if (cookieProxyConfig) {
391
- const proxiedCookies = createEncryptedCookieProxy(event.cookies, cookieProxyConfig);
392
- Object.defineProperty(event, "cookies", {
393
- value: proxiedCookies,
394
- writable: true,
395
- configurable: true
396
- });
397
- }
398
- const runRequest = async () => {
399
- try {
400
- if (a2aResolved) {
401
- const a2aResponse = await handleA2ARequest(event, requestId, a2aResolved);
402
- if (a2aResponse)
403
- return a2aResponse;
404
- }
405
- let session;
406
- if (authConfig) {
407
- const token = getAccessToken(event.request, event.cookies);
408
- if (token) {
409
- session = await authConfig.verifyToken(token) ?? void 0;
410
- locals.session = session;
411
- if (session) {
412
- locals.accessToken = token;
413
- }
383
+ const suppliedRequestId = event.request.headers.get("x-request-id");
384
+ const requestId = suppliedRequestId && /^[\w.:-]{1,128}$/.test(suppliedRequestId) ? suppliedRequestId : generateId("req");
385
+ return core.context.run({ requestId, userId: void 0, scopeId: void 0, jobId: void 0 }, async () => {
386
+ const context = {
387
+ event,
388
+ requestId
389
+ };
390
+ const locals = event.locals;
391
+ locals.requestId = requestId;
392
+ if (cookieProxyConfig) {
393
+ const proxiedCookies = createEncryptedCookieProxy(event.cookies, cookieProxyConfig);
394
+ Object.defineProperty(event, "cookies", {
395
+ value: proxiedCookies,
396
+ writable: true,
397
+ configurable: true
398
+ });
399
+ }
400
+ const runRequest = async () => {
401
+ try {
402
+ if (a2aResolved) {
403
+ const a2aResponse = await handleA2ARequest(event, requestId, a2aResolved);
404
+ if (a2aResponse)
405
+ return a2aResponse;
414
406
  }
415
- }
416
- context.session = session;
417
- for (const guardConfig of guards) {
418
- const guardResult = await executeGuard(guardConfig, event, session);
419
- if (!guardResult.allowed) {
420
- if (guardResult.redirect) {
421
- return new Response(null, {
422
- status: 302,
423
- headers: { Location: guardResult.redirect }
424
- });
407
+ let session;
408
+ if (authConfig) {
409
+ const token = getAccessToken(event.request, event.cookies);
410
+ if (token) {
411
+ session = await authConfig.verifyToken(token) ?? void 0;
412
+ locals.session = session;
413
+ if (session) {
414
+ locals.accessToken = token;
415
+ }
425
416
  }
426
- return new Response(
427
- JSON.stringify({
428
- success: false,
429
- error: {
430
- code: "FORBIDDEN",
431
- message: guardResult.message ?? kitM("kit_accessDenied")
432
- },
433
- requestId
434
- }),
435
- {
436
- status: guardResult.status ?? 403,
437
- headers: { "Content-Type": "application/json" }
417
+ }
418
+ context.session = session;
419
+ return await core.context.run({ userId: session?.userId }, async () => {
420
+ for (const guardConfig of guards) {
421
+ const guardResult = await executeGuard(guardConfig, event, session);
422
+ if (!guardResult.allowed) {
423
+ if (guardResult.redirect) {
424
+ return new Response(null, {
425
+ status: 302,
426
+ headers: { Location: guardResult.redirect }
427
+ });
428
+ }
429
+ return new Response(
430
+ JSON.stringify({
431
+ success: false,
432
+ error: {
433
+ code: "FORBIDDEN",
434
+ message: guardResult.message ?? kitM("kit_accessDenied")
435
+ },
436
+ requestId
437
+ }),
438
+ {
439
+ status: guardResult.status ?? 403,
440
+ headers: { "Content-Type": "application/json" }
441
+ }
442
+ );
438
443
  }
444
+ }
445
+ const response2 = await executeMiddlewareChain(
446
+ allMiddleware,
447
+ context,
448
+ () => resolve(event)
439
449
  );
450
+ return response2;
451
+ });
452
+ } catch (error2) {
453
+ if (isSvelteKitControlFlow(error2)) {
454
+ throw error2;
440
455
  }
441
- }
442
- const response2 = await executeMiddlewareChain(
443
- allMiddleware,
444
- context,
445
- () => resolve(event)
446
- );
447
- return response2;
448
- } catch (error2) {
449
- if (isSvelteKitControlFlow(error2)) {
450
- throw error2;
451
- }
452
- core.logger.error("Request failed", { requestId, error: error2 instanceof Error ? error2.message : error2 });
453
- if (onError) {
454
- return onError(error2, event);
455
- }
456
- return new Response(
457
- JSON.stringify({
458
- success: false,
459
- error: {
460
- code: "INTERNAL_ERROR",
461
- message: kitM("kit_internalError")
462
- },
463
- requestId
464
- }),
465
- {
466
- status: 500,
467
- headers: { "Content-Type": "application/json" }
456
+ core.logger.error("Request failed", { requestId, error: error2 instanceof Error ? error2.message : error2 });
457
+ if (onError) {
458
+ return onError(error2, event);
468
459
  }
469
- );
470
- }
471
- };
472
- const response = transportMiddleware ? await transportMiddleware(context, runRequest) : await runRequest();
473
- applyDefaultSecurityHeaders(response);
474
- response.headers.set("X-Request-Id", requestId);
475
- return response;
460
+ return new Response(
461
+ JSON.stringify({
462
+ success: false,
463
+ error: {
464
+ code: "INTERNAL_ERROR",
465
+ message: kitM("kit_internalError")
466
+ },
467
+ requestId
468
+ }),
469
+ {
470
+ status: 500,
471
+ headers: { "Content-Type": "application/json" }
472
+ }
473
+ );
474
+ }
475
+ };
476
+ const response = transportMiddleware ? await transportMiddleware(context, runRequest) : await runRequest();
477
+ applyDefaultSecurityHeaders(response);
478
+ response.headers.set("X-Request-Id", requestId);
479
+ return response;
480
+ });
476
481
  };
477
482
  }
478
483
  function buildAuthGuard(verifyToken, loginUrl) {
@@ -541,7 +546,8 @@ function buildTransportMiddleware(cryptoConfig) {
541
546
  serverKeyRing: transportOpts.serverKeyRing,
542
547
  keyExchangePath: transportOpts.keyExchangePath,
543
548
  excludePaths: transportOpts.excludePaths,
544
- keyStore: transportOpts.keyStore
549
+ keyStore: transportOpts.keyStore,
550
+ maxPlaintextBytes: transportOpts.maxPlaintextBytes
545
551
  });
546
552
  }
547
553
  function buildCookieProxyConfig(cryptoConfig) {
@@ -815,9 +821,124 @@ function createAuthApi(iam) {
815
821
  })
816
822
  };
817
823
  }
824
+ function createFeedbackHandler(options) {
825
+ const basePath = (options.basePath ?? "/api/feedback").replace(/\/+$/, "");
826
+ return async (event) => {
827
+ let actor;
828
+ try {
829
+ actor = await options.resolveContext(event);
830
+ } catch {
831
+ return fromError({ ...HaiCommonError.INTERNAL_ERROR, message: kitM("kit_internalError") });
832
+ }
833
+ if (!actor?.scopeId || !actor.userId)
834
+ return fromError({ ...HaiCommonError.UNAUTHORIZED, message: kitM("kit_unauthorized") });
835
+ const suffix = event.url.pathname.startsWith(`${basePath}/`) ? event.url.pathname.slice(basePath.length + 1) : "";
836
+ let parts;
837
+ try {
838
+ parts = suffix.split("/").map(decodeURIComponent);
839
+ } catch {
840
+ return invalid(400);
841
+ }
842
+ if (parts[0] !== "reports" || parts.length > 4)
843
+ return fromError({ ...HaiCommonError.NOT_FOUND, message: core.i18n.coreM("core_errorNotFound") });
844
+ let body = {};
845
+ if (!["GET", "HEAD"].includes(event.request.method)) {
846
+ if (event.request.headers.get("content-type")?.split(";")[0]?.trim().toLowerCase() !== "application/json")
847
+ return invalid(415);
848
+ try {
849
+ body = await readBoundedJson(event.request);
850
+ } catch (error2) {
851
+ return invalid(error2 instanceof RangeError ? 413 : 400);
852
+ }
853
+ }
854
+ if (!body || typeof body !== "object" || Array.isArray(body))
855
+ return invalid(400);
856
+ const bodyRecord = body;
857
+ if (parts[1] && Object.hasOwn(bodyRecord, "id") && bodyRecord.id !== parts[1])
858
+ return invalid(400);
859
+ const input = { ...Object.fromEntries(event.url.searchParams), ...bodyRecord, ...parts[1] ? { id: parts[1] } : {} };
860
+ const method = event.request.method;
861
+ const service = options.feedback;
862
+ async function execute(schema, operation) {
863
+ const parsed = schema.safeParse(input);
864
+ if (!parsed.success)
865
+ return invalid(400);
866
+ try {
867
+ const result = await core.context.run(actor, () => operation(parsed.data));
868
+ return result.success ? ok(result.data) : fromError(result.error);
869
+ } catch {
870
+ return fromError({ ...HaiCommonError.INTERNAL_ERROR, message: kitM("kit_internalError") });
871
+ }
872
+ }
873
+ if (parts.length === 1) {
874
+ if (method === "POST")
875
+ return execute(FeedbackSubmitInputSchema, (value) => service.submit(value, actor));
876
+ if (method === "GET")
877
+ return execute(FeedbackListInputSchema, (value) => service.list(value, actor));
878
+ }
879
+ if (parts.length === 2 && method === "GET")
880
+ return execute(FeedbackIdInputSchema, (value) => service.get(value.id, actor));
881
+ if (parts.length === 3) {
882
+ if (parts[2] === "evidence" && method === "GET")
883
+ return execute(FeedbackEvidenceQuerySchema, (value) => service.getEvidence(value, actor));
884
+ if (parts[2] === "evidence" && method === "POST")
885
+ return execute(FeedbackAppendEvidenceInputSchema, (value) => service.appendEvidence(value, actor));
886
+ if (parts[2] === "status" && method === "PATCH")
887
+ return execute(FeedbackSetStatusInputSchema, (value) => service.setStatus(value, actor));
888
+ if (parts[2] === "retry" && method === "POST")
889
+ return execute(FeedbackRetryInputSchema, (value) => service.retry(value, actor));
890
+ if (parts[2] === "complete" && method === "POST")
891
+ return execute(FeedbackCompleteInputSchema, (value) => service.completeCollection(value, actor));
892
+ if (parts[2] === "exports" && method === "POST")
893
+ return execute(FeedbackExportInputSchema, (value) => service.export(value, actor));
894
+ }
895
+ if (parts.length === 4 && parts[2] === "attachments") {
896
+ Object.assign(input, { attachmentId: parts[3] });
897
+ if (method === "POST")
898
+ return execute(FeedbackUploadInputSchema, (value) => service.uploadAttachment(value, actor));
899
+ if (method === "GET")
900
+ return execute(FeedbackAttachmentQuerySchema, (value) => service.getAttachment(value, actor));
901
+ }
902
+ if (parts.length === 4 && parts[2] === "exports" && method === "GET") {
903
+ Object.assign(input, { jobId: parts[3] });
904
+ return execute(FeedbackExportQuerySchema, (value) => service.getExport(value, actor));
905
+ }
906
+ return fromError({ ...HaiCommonError.NOT_FOUND, message: core.i18n.coreM("core_errorNotFound") });
907
+ };
908
+ }
909
+ function invalid(status) {
910
+ return fromError({ ...HaiCommonError.INVALID_REQUEST, httpStatus: status, message: kitM("kit_validationFailed") });
911
+ }
912
+ async function readBoundedJson(request) {
913
+ const reader = request.body?.getReader();
914
+ if (!reader)
915
+ return {};
916
+ const decoder = new TextDecoder();
917
+ let length = 0;
918
+ let text = "";
919
+ try {
920
+ while (true) {
921
+ const chunk = await reader.read();
922
+ if (chunk.done)
923
+ break;
924
+ length += chunk.value.byteLength;
925
+ if (length > 8 * 1024 * 1024) {
926
+ await reader.cancel();
927
+ throw new RangeError("Feedback request is too large");
928
+ }
929
+ text += decoder.decode(chunk.value, { stream: true });
930
+ }
931
+ text += decoder.decode();
932
+ return text ? JSON.parse(text) : {};
933
+ } finally {
934
+ reader.releaseLock();
935
+ }
936
+ }
818
937
 
819
938
  // src/kit-main.ts
820
939
  var kit = {
940
+ /** 创建反馈的受控 catch-all HTTP handler,身份范围由宿主解析。 */
941
+ createFeedbackHandler,
821
942
  /** 原子限流工厂;共享store生命周期由应用管理。 */
822
943
  middleware: {
823
944
  rateLimit: rateLimitMiddleware,