@h-ai/kit 1.0.0-beta.19 → 1.0.0-beta.20

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.
@@ -1,5 +1,5 @@
1
1
  import { RequestEvent } from '@sveltejs/kit';
2
- import { g as HandleA2AOperations, i as HandleConfig } from './kit-types-BUDaKGB0.js';
2
+ import { g as HandleA2AOperations, i as HandleConfig } from './kit-types-Cr1cnB3M.js';
3
3
 
4
4
  /**
5
5
  * @h-ai/kit — A2A API Key 认证器
@@ -1,4 +1,4 @@
1
- import { o as KitServerConfig, q as KitTransportConfig, m as KitConfigInput, l as KitConfig, r as KitTransportConfigInput } from './kit-types-BUDaKGB0.js';
1
+ import { o as KitServerConfig, q as KitTransportConfig, m as KitConfigInput, l as KitConfig, r as KitTransportConfigInput } from './kit-types-Cr1cnB3M.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  /**
@@ -1017,23 +1017,17 @@ declare function redirect(url: string, status?: 301 | 302 | 303 | 307 | 308): Re
1017
1017
  * @returns 标准化 JSON Response
1018
1018
  * @example
1019
1019
  * ```ts
1020
+ * import { err, HaiCommonError, type HaiResult } from '@h-ai/core'
1020
1021
  * import { kit } from '@h-ai/kit'
1021
1022
  *
1022
- * const response = kit.response.fromResult({ success: true, data: { id: 'article_1' } })
1023
+ * function respond(result: HaiResult<{ id: string }>): Response {
1024
+ * return kit.response.fromResult(result)
1025
+ * }
1026
+ * const response = kit.response.fromResult(err(HaiCommonError.NOT_FOUND, 'Article missing'))
1023
1027
  * void response.status
1024
1028
  * ```
1025
1029
  */
1026
- declare function fromResult<T>(result: {
1027
- success: true;
1028
- data: T;
1029
- } | {
1030
- success: false;
1031
- error: {
1032
- code: number | string;
1033
- message: string;
1034
- [key: string]: unknown;
1035
- };
1036
- }, httpStatusMap?: Record<number | string, number>, requestId?: string): Response;
1030
+ declare function fromResult<T>(result: HaiResult<T>, httpStatusMap?: Record<number | string, number>, requestId?: string): Response;
1037
1031
  /**
1038
1032
  * 按模块错误的 HTTP 状态构建安全的统一 API 错误响应。
1039
1033
  * @param haiError - 包含 code、message 和可选 httpStatus 的模块错误。
@@ -1781,7 +1775,7 @@ interface HandleConfig {
1781
1775
  *
1782
1776
  * 启用后 kit 自动在 Handle 中完成:
1783
1777
  * - 传输加密:请求体解密 / 响应体加密 / 密钥交换端点
1784
- * - Cookie 加密:对指定 Cookie 的 get/set 自动 AES 加解密
1778
+ * - Cookie 加密:对指定 Cookie 的 get/set 使用 SM4-CBC 加解密并验证 HMAC-SHA256 认证
1785
1779
  */
1786
1780
  crypto?: HookCryptoConfig;
1787
1781
  /** 自定义错误处理(不提供则使用内置的 500 JSON 响应) */
@@ -1,7 +1,7 @@
1
- import { K as KitA2AHandlerConfig } from '../../kit-a2a-types-CeDikRAX.js';
2
- export { A as A2AApiKeyAuthConfig, R as ResolvedA2AConfig, c as createA2AApiKeyAuthenticator, h as handleA2ARequest, r as resolveA2AConfig } from '../../kit-a2a-types-CeDikRAX.js';
1
+ import { K as KitA2AHandlerConfig } from '../../kit-a2a-types-sw7sI-ZT.js';
2
+ export { A as A2AApiKeyAuthConfig, R as ResolvedA2AConfig, c as createA2AApiKeyAuthenticator, h as handleA2ARequest, r as resolveA2AConfig } from '../../kit-a2a-types-sw7sI-ZT.js';
3
3
  import { RequestHandler } from '@sveltejs/kit';
4
- import '../../kit-types-BUDaKGB0.js';
4
+ import '../../kit-types-Cr1cnB3M.js';
5
5
  import '@h-ai/core';
6
6
  import '@h-ai/crypto';
7
7
  import '@h-ai/iam';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@h-ai/kit",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.19",
4
+ "version": "1.0.0-beta.20",
5
5
  "description": "Hai Framework SvelteKit integration module.",
6
6
  "license": "Apache-2.0",
7
7
  "exports": {
@@ -43,7 +43,7 @@
43
43
  "node": "^22.23.4 || ^24.22.1 || ^26.12.1"
44
44
  },
45
45
  "peerDependencies": {
46
- "@h-ai/feedback": "1.0.0-beta.19",
46
+ "@h-ai/feedback": "1.0.0-beta.20",
47
47
  "@sveltejs/adapter-node": "^6.0.1",
48
48
  "@sveltejs/adapter-static": "^4.0.1",
49
49
  "@sveltejs/kit": "^3.1.1",
@@ -61,17 +61,17 @@
61
61
  }
62
62
  },
63
63
  "dependencies": {
64
- "@h-ai/api-contract": "1.0.0-beta.19",
65
- "@h-ai/audit": "1.0.0-beta.19",
66
- "@h-ai/core": "1.0.0-beta.19",
67
- "@h-ai/crypto": "1.0.0-beta.19",
68
- "@h-ai/iam": "1.0.0-beta.19",
64
+ "@h-ai/api-contract": "1.0.0-beta.20",
65
+ "@h-ai/audit": "1.0.0-beta.20",
66
+ "@h-ai/core": "1.0.0-beta.20",
67
+ "@h-ai/crypto": "1.0.0-beta.20",
68
+ "@h-ai/iam": "1.0.0-beta.20",
69
69
  "zod": "^4.6.7"
70
70
  },
71
71
  "devDependencies": {
72
- "@h-ai/cache": "1.0.0-beta.19",
73
- "@h-ai/feedback": "1.0.0-beta.19",
74
- "@h-ai/reldb": "1.0.0-beta.19",
72
+ "@h-ai/cache": "1.0.0-beta.20",
73
+ "@h-ai/feedback": "1.0.0-beta.20",
74
+ "@h-ai/reldb": "1.0.0-beta.20",
75
75
  "@sveltejs/kit": "^3.1.1",
76
76
  "@types/node": "^26.6.6",
77
77
  "rimraf": "^6.1.4",