@heybox/hb-sdk 0.8.1-alpha.6 → 0.8.1-alpha.7
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/CHANGELOG.md +4 -0
- package/README.md +2 -2
- package/dist/cli-chunks/{build-B0X9pazW.cjs → build-C8oN_Ms9.cjs} +4 -4
- package/dist/cli-chunks/{context-DVfWZ6d1.cjs → context-DZkqvg9S.cjs} +2 -2
- package/dist/cli-chunks/{create-CyQWVxCA.cjs → create-CToSHRfO.cjs} +1 -1
- package/dist/cli-chunks/{dev-DP7WtQOo.cjs → dev-CTA0lsLD.cjs} +24 -32
- package/dist/cli-chunks/{doctor-D6l-ONq-.cjs → doctor-DRa_kjP1.cjs} +1 -1
- package/dist/cli-chunks/{index-DvOPzPxS.cjs → index-Bkl5YmtN.cjs} +2 -2
- package/dist/cli-chunks/{index-CDwwaNvP.cjs → index-zNpZDWhc.cjs} +15 -15
- package/dist/cli-chunks/{index.esm-B8pX0BrZ.cjs → index.esm-CGoUW47e.cjs} +7 -7
- package/dist/cli-chunks/{login-Dt-FHzpL.cjs → login-CCEPk2Ok.cjs} +2 -2
- package/dist/cli-chunks/{project-vite-CE7kyqxl.cjs → project-vite-couFw5bL.cjs} +1 -1
- package/dist/cli-chunks/{remote-Be6PeR-n.cjs → remote-DQ70o-Km.cjs} +6 -6
- package/dist/cli-chunks/{runtime-permission-env-DWSscWBT.cjs → runtime-permission-env-BN43V7d0.cjs} +1 -1
- package/dist/cli-chunks/{session-DZXRQ4Dp.cjs → session-C1R_39si.cjs} +1 -1
- package/dist/cli-chunks/{skill-B8GWL2KT.cjs → skill-CVXOE5jH.cjs} +2 -2
- package/dist/cli-chunks/{version-D19lZmYN.cjs → version-DbDVL6vm.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/devtools/browser-dev-host/assets/browser-dev-host-CH6L1ZJI.js +101 -0
- package/dist/devtools/browser-dev-host/assets/{index-Dh5wRj5c.js → index-DocojUxT.js} +2 -2
- package/dist/devtools/browser-dev-host/index.html +1 -1
- package/dist/index.cjs.js +1 -10
- package/dist/index.esm.js +1 -10
- package/dist/vite.cjs.js +1 -1
- package/dist/vite.esm.js +1 -1
- package/package.json +6 -6
- package/skill/references/api-root.md +1 -1
- package/skill/references/safety-boundaries.md +2 -2
- package/skill/skill.json +5 -5
- package/types/modules/network/index.d.ts +1 -4
- package/types/modules/network/observability.d.ts +0 -1
- package/dist/devtools/browser-dev-host/assets/browser-dev-host-Bb43BPMS.js +0 -101
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<meta name="theme-color" content="#f4f5f7" />
|
|
7
7
|
<title>小程序工坊调试台</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-DocojUxT.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/desktop-app-launch-DnPRjCa3.js">
|
|
10
10
|
<link rel="stylesheet" crossorigin href="/assets/index-D-aNERAr.css">
|
|
11
11
|
</head>
|
package/dist/index.cjs.js
CHANGED
|
@@ -835,7 +835,7 @@ function createMessageId() {
|
|
|
835
835
|
/** 构建时替换为当前发布包的实际版本。 */
|
|
836
836
|
const HB_SDK_VERSION = typeof undefined === 'string'
|
|
837
837
|
? undefined
|
|
838
|
-
: '0.8.1-alpha.
|
|
838
|
+
: '0.8.1-alpha.7';
|
|
839
839
|
|
|
840
840
|
const RUNTIME_MODES = new Set(['production', 'preview', 'development', 'unknown']);
|
|
841
841
|
const OPERATING_SYSTEM_NAMES = new Set(['android', 'ios', 'ohos', 'windows', 'macos', 'linux', 'unknown']);
|
|
@@ -3364,9 +3364,6 @@ function createNetworkRequestFailureLog(config, error, extras) {
|
|
|
3364
3364
|
if (config.timeout !== undefined) {
|
|
3365
3365
|
detail.timeout = config.timeout;
|
|
3366
3366
|
}
|
|
3367
|
-
if (config.withCredentials !== undefined) {
|
|
3368
|
-
detail.withCredentials = config.withCredentials;
|
|
3369
|
-
}
|
|
3370
3367
|
const headers = sanitizeNetworkHeaders(extras.headers || config.headers);
|
|
3371
3368
|
if (Object.keys(headers).length > 0) {
|
|
3372
3369
|
detail.headers = headers;
|
|
@@ -3404,7 +3401,6 @@ function snapshotRequestConfig(config) {
|
|
|
3404
3401
|
...(config.data === undefined ? {} : { data: clonePublicValue(config.data) }),
|
|
3405
3402
|
...(config.headers === undefined ? {} : { headers: clonePublicValue(config.headers) }),
|
|
3406
3403
|
...(config.timeout === undefined ? {} : { timeout: config.timeout }),
|
|
3407
|
-
...(config.withCredentials === undefined ? {} : { withCredentials: config.withCredentials }),
|
|
3408
3404
|
...(config.validateStatus === undefined ? {} : { validateStatus: config.validateStatus }),
|
|
3409
3405
|
};
|
|
3410
3406
|
}
|
|
@@ -3416,7 +3412,6 @@ function toRequestPayload(config) {
|
|
|
3416
3412
|
...(config.data === undefined ? {} : { data: clonePublicValue(config.data) }),
|
|
3417
3413
|
...(config.headers === undefined ? {} : { headers: clonePublicValue(config.headers) }),
|
|
3418
3414
|
...(config.timeout === undefined ? {} : { timeout: config.timeout }),
|
|
3419
|
-
...(config.withCredentials === undefined ? {} : { withCredentials: config.withCredentials }),
|
|
3420
3415
|
};
|
|
3421
3416
|
}
|
|
3422
3417
|
function normalizeHeaders(headers) {
|
|
@@ -3585,9 +3580,6 @@ function normalizeDownloadPayload(options, to, isFileTarget) {
|
|
|
3585
3580
|
if (options.maxBytes !== undefined && (!Number.isSafeInteger(options.maxBytes) || options.maxBytes <= 0)) {
|
|
3586
3581
|
throw createSDKError('INVALID_PARAMS', 'maxBytes 必须是正的 safe integer');
|
|
3587
3582
|
}
|
|
3588
|
-
if (options.withCredentials !== undefined && typeof options.withCredentials !== 'boolean') {
|
|
3589
|
-
throw createSDKError('INVALID_PARAMS', 'withCredentials 必须是 boolean');
|
|
3590
|
-
}
|
|
3591
3583
|
if (options.onProgress !== undefined && typeof options.onProgress !== 'function') {
|
|
3592
3584
|
throw createSDKError('INVALID_PARAMS', 'onProgress 必须是函数');
|
|
3593
3585
|
}
|
|
@@ -3607,7 +3599,6 @@ function normalizeDownloadPayload(options, to, isFileTarget) {
|
|
|
3607
3599
|
...(options.params === undefined ? {} : { params: clonePublicValue(options.params) }),
|
|
3608
3600
|
...(options.headers === undefined ? {} : { headers: clonePublicValue(options.headers) }),
|
|
3609
3601
|
...(options.timeout === undefined ? {} : { timeout: options.timeout }),
|
|
3610
|
-
...(options.withCredentials === undefined ? {} : { withCredentials: options.withCredentials }),
|
|
3611
3602
|
...(options.maxBytes === undefined ? {} : { maxBytes: options.maxBytes }),
|
|
3612
3603
|
};
|
|
3613
3604
|
if (isFileTarget) {
|
package/dist/index.esm.js
CHANGED
|
@@ -831,7 +831,7 @@ function createMessageId() {
|
|
|
831
831
|
/** 构建时替换为当前发布包的实际版本。 */
|
|
832
832
|
const HB_SDK_VERSION = typeof undefined === 'string'
|
|
833
833
|
? undefined
|
|
834
|
-
: '0.8.1-alpha.
|
|
834
|
+
: '0.8.1-alpha.7';
|
|
835
835
|
|
|
836
836
|
const RUNTIME_MODES = new Set(['production', 'preview', 'development', 'unknown']);
|
|
837
837
|
const OPERATING_SYSTEM_NAMES = new Set(['android', 'ios', 'ohos', 'windows', 'macos', 'linux', 'unknown']);
|
|
@@ -3360,9 +3360,6 @@ function createNetworkRequestFailureLog(config, error, extras) {
|
|
|
3360
3360
|
if (config.timeout !== undefined) {
|
|
3361
3361
|
detail.timeout = config.timeout;
|
|
3362
3362
|
}
|
|
3363
|
-
if (config.withCredentials !== undefined) {
|
|
3364
|
-
detail.withCredentials = config.withCredentials;
|
|
3365
|
-
}
|
|
3366
3363
|
const headers = sanitizeNetworkHeaders(extras.headers || config.headers);
|
|
3367
3364
|
if (Object.keys(headers).length > 0) {
|
|
3368
3365
|
detail.headers = headers;
|
|
@@ -3400,7 +3397,6 @@ function snapshotRequestConfig(config) {
|
|
|
3400
3397
|
...(config.data === undefined ? {} : { data: clonePublicValue(config.data) }),
|
|
3401
3398
|
...(config.headers === undefined ? {} : { headers: clonePublicValue(config.headers) }),
|
|
3402
3399
|
...(config.timeout === undefined ? {} : { timeout: config.timeout }),
|
|
3403
|
-
...(config.withCredentials === undefined ? {} : { withCredentials: config.withCredentials }),
|
|
3404
3400
|
...(config.validateStatus === undefined ? {} : { validateStatus: config.validateStatus }),
|
|
3405
3401
|
};
|
|
3406
3402
|
}
|
|
@@ -3412,7 +3408,6 @@ function toRequestPayload(config) {
|
|
|
3412
3408
|
...(config.data === undefined ? {} : { data: clonePublicValue(config.data) }),
|
|
3413
3409
|
...(config.headers === undefined ? {} : { headers: clonePublicValue(config.headers) }),
|
|
3414
3410
|
...(config.timeout === undefined ? {} : { timeout: config.timeout }),
|
|
3415
|
-
...(config.withCredentials === undefined ? {} : { withCredentials: config.withCredentials }),
|
|
3416
3411
|
};
|
|
3417
3412
|
}
|
|
3418
3413
|
function normalizeHeaders(headers) {
|
|
@@ -3581,9 +3576,6 @@ function normalizeDownloadPayload(options, to, isFileTarget) {
|
|
|
3581
3576
|
if (options.maxBytes !== undefined && (!Number.isSafeInteger(options.maxBytes) || options.maxBytes <= 0)) {
|
|
3582
3577
|
throw createSDKError('INVALID_PARAMS', 'maxBytes 必须是正的 safe integer');
|
|
3583
3578
|
}
|
|
3584
|
-
if (options.withCredentials !== undefined && typeof options.withCredentials !== 'boolean') {
|
|
3585
|
-
throw createSDKError('INVALID_PARAMS', 'withCredentials 必须是 boolean');
|
|
3586
|
-
}
|
|
3587
3579
|
if (options.onProgress !== undefined && typeof options.onProgress !== 'function') {
|
|
3588
3580
|
throw createSDKError('INVALID_PARAMS', 'onProgress 必须是函数');
|
|
3589
3581
|
}
|
|
@@ -3603,7 +3595,6 @@ function normalizeDownloadPayload(options, to, isFileTarget) {
|
|
|
3603
3595
|
...(options.params === undefined ? {} : { params: clonePublicValue(options.params) }),
|
|
3604
3596
|
...(options.headers === undefined ? {} : { headers: clonePublicValue(options.headers) }),
|
|
3605
3597
|
...(options.timeout === undefined ? {} : { timeout: options.timeout }),
|
|
3606
|
-
...(options.withCredentials === undefined ? {} : { withCredentials: options.withCredentials }),
|
|
3607
3598
|
...(options.maxBytes === undefined ? {} : { maxBytes: options.maxBytes }),
|
|
3608
3599
|
};
|
|
3609
3600
|
if (isFileTarget) {
|
package/dist/vite.cjs.js
CHANGED
|
@@ -11,7 +11,7 @@ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentS
|
|
|
11
11
|
/** 构建时替换为当前发布包的实际版本。 */
|
|
12
12
|
const HB_SDK_VERSION = typeof undefined === 'string'
|
|
13
13
|
? undefined
|
|
14
|
-
: '0.8.1-alpha.
|
|
14
|
+
: '0.8.1-alpha.7';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* iframe 与调试台页面的开发期 console 捕获转发。
|
package/dist/vite.esm.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heybox/hb-sdk",
|
|
3
|
-
"version": "0.8.1-alpha.
|
|
3
|
+
"version": "0.8.1-alpha.7",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"./src/index.ts",
|
|
6
6
|
"./src/core/singleton.ts",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"skills": "1.5.23",
|
|
63
63
|
"undici": "^7.28.0",
|
|
64
64
|
"ws": "^8.18.0",
|
|
65
|
-
"@heybox/hb-sdk-protocol": "0.8.1-alpha.
|
|
65
|
+
"@heybox/hb-sdk-protocol": "0.8.1-alpha.7"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"vite": ">=5"
|
|
@@ -113,13 +113,13 @@
|
|
|
113
113
|
"vue-tsc": "^3.3.7",
|
|
114
114
|
"vite": "^8.0.12",
|
|
115
115
|
"vitest": "^3.2.4",
|
|
116
|
-
"@heybox-domain/heybox-theme": "~0.1.0",
|
|
117
116
|
"@heybox/hb-api": "~1.28.3",
|
|
117
|
+
"@heybox-domain/heybox-theme": "~0.1.0",
|
|
118
|
+
"@heybox/hb-sdk-runtime": "~0.8.1-alpha.7",
|
|
119
|
+
"@heybox/runtime-policy": "~0.2.0",
|
|
118
120
|
"@heybox-domain/heybox-vue3-ui": "~0.1.0",
|
|
119
|
-
"@heybox/hb-sdk-runtime": "~0.8.1-alpha.6",
|
|
120
|
-
"@heybox/runtime": "~0.2.0",
|
|
121
121
|
"@heybox/runtime-transport-fetch": "~0.2.0",
|
|
122
|
-
"@heybox/runtime
|
|
122
|
+
"@heybox/runtime": "~0.2.0"
|
|
123
123
|
},
|
|
124
124
|
"publishConfig": {
|
|
125
125
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
## Package metadata
|
|
28
28
|
|
|
29
29
|
- Package: `@heybox/hb-sdk`
|
|
30
|
-
- Version at generation time: `0.8.1-alpha.
|
|
30
|
+
- Version at generation time: `0.8.1-alpha.7`
|
|
31
31
|
- Public root export: `@heybox/hb-sdk`
|
|
32
32
|
- Protocol export: `@heybox/hb-sdk/protocol`
|
|
33
33
|
- Vite plugin export: `@heybox/hb-sdk/vite`
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
- `auth.login()`、`user.getInfo()` 和 `user.getSteamGameList()` 的可用性不由 `network` 决定;它们分别要求 `userInfo` 或 `steamLibrary`,并继续遵循各自的用户授权和数据规则。
|
|
19
19
|
- `user.revokeAuthorization()` 在两种网络模式下都要求可信用户手势;成功后必须停止使用并清理业务缓存的旧身份、资料和服务端会话。
|
|
20
20
|
- `on()` 返回取消监听函数,组件卸载或页面销毁时需要调用。
|
|
21
|
-
-
|
|
21
|
+
- 现有业务网络请求仍使用 `network.request()`;该 API 已标记废弃,但目前没有替代调用入口,不要依赖浏览器原生网络出口。
|
|
22
22
|
- 公开 `network.request()` 与 `network.download()` 均使用 no-follow redirect policy;3xx 不会在 Host 内静默跳转。
|
|
23
23
|
- `network.request()` 不能访问平台保留的 runtime auth 与 OpenAPI 内部路径;页面不得持有或交换服务端应用凭据。
|
|
24
24
|
- `network.request` 不支持 `multipart/form-data`;App Host 仅支持 form(`application/x-www-form-urlencoded`)与 JSON。表单请用 `URLSearchParams#toString()` 作为 `data`,文件上传请走专用上传能力。
|
|
25
25
|
- 新 PC 开放持久 sandbox、单文件/目录 picker、精确 File 保存与公网 `network.download()`;多选和小黑盒域名流式下载暂不支持。Mobile、Web 与 Browser Dev Host 仍未开放这些 primitive。
|
|
26
|
-
-
|
|
26
|
+
- `withCredentials` 不再是支持的配置字段,也不会进入新 SDK、协议或 Host contract;旧 SDK 构建产物的 wire 字段仅由 Runtime 兼容忽略。Mobile 对官方 HTTPS 默认端口目标自动启用 Native Cookie,第三方关闭;应用可显式提供 `Cookie`、`Authorization` 等请求头。`Origin`、`Referer`、`User-Agent` 由 Host 接管;`Host`、分帧及逐跳请求头由传输层管理,不能由小程序设置。Web Host 使用浏览器 Fetch,无法发送显式 `Cookie` 等浏览器禁止的头,会返回 `REQUEST_UNSUPPORTED`;需要第三方 Cookie 会话时请在支持原始请求头的 Mobile/PC Host 验收。
|
|
27
27
|
- 新 PC 不支持振动、分享菜单和截图分享;`navigation.openAppPage` 仅支持 `game_detail`,用户/帖子详情会明确失败。调用平台相关能力时应处理 `METHOD_FORBIDDEN` 或 `REQUEST_UNSUPPORTED`。
|
|
28
28
|
- picker 必须来自可信用户手势;取消选择返回 `FILE_PICKER_CANCELLED`。`saveFile()` 只接受 `suggestedName`,不接受 `accept`。
|
|
29
29
|
- `pickFiles()` / `pickDirectory()` 默认只读;`pickFiles()` 仅在显式传入 `multiple: true` 时允许 Host 返回多个文件。要写入或作为下载目标时显式请求 `mode: 'readwrite'`。
|
package/skill/skill.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hb-sdk",
|
|
3
|
-
"skillVersion": "0.8.1-alpha.
|
|
3
|
+
"skillVersion": "0.8.1-alpha.7+skill.cc51aa429a00",
|
|
4
4
|
"sdk": {
|
|
5
5
|
"package": "@heybox/hb-sdk",
|
|
6
|
-
"version": "0.8.1-alpha.
|
|
7
|
-
"compatibility": "0.8.1-alpha.
|
|
6
|
+
"version": "0.8.1-alpha.7",
|
|
7
|
+
"compatibility": "0.8.1-alpha.7"
|
|
8
8
|
},
|
|
9
9
|
"distribution": {
|
|
10
10
|
"type": "npm",
|
|
11
11
|
"package": "@heybox/hb-sdk",
|
|
12
|
-
"version": "0.8.1-alpha.
|
|
12
|
+
"version": "0.8.1-alpha.7",
|
|
13
13
|
"path": "skill"
|
|
14
14
|
},
|
|
15
|
-
"integrity": "sha256-
|
|
15
|
+
"integrity": "sha256-cc51aa429a00b117c134cff1c71b42c6e72fcb9e169533428eaa8d9f54b6a853"
|
|
16
16
|
}
|
|
@@ -38,8 +38,6 @@ export interface MiniProgramNetworkRequestConfig {
|
|
|
38
38
|
headers?: MiniProgramNetworkHeaders;
|
|
39
39
|
/** 超时时间,单位毫秒。 */
|
|
40
40
|
timeout?: number;
|
|
41
|
-
/** 是否携带凭据意图;具体策略由宿主运行时决定。 */
|
|
42
|
-
withCredentials?: boolean;
|
|
43
41
|
/** SDK 侧状态校验;不会跨 bridge 传输函数值。 */
|
|
44
42
|
validateStatus?: MiniProgramNetworkValidateStatus;
|
|
45
43
|
}
|
|
@@ -54,7 +52,6 @@ export interface DownloadBaseOptions {
|
|
|
54
52
|
params?: MiniProgramNetworkParams;
|
|
55
53
|
headers?: MiniProgramNetworkHeaders;
|
|
56
54
|
timeout?: number;
|
|
57
|
-
withCredentials?: boolean;
|
|
58
55
|
maxBytes?: number;
|
|
59
56
|
signal?: AbortSignal;
|
|
60
57
|
onProgress?: (progress: DownloadProgress) => void;
|
|
@@ -82,7 +79,6 @@ export interface NetworkRequestPayload {
|
|
|
82
79
|
data?: unknown;
|
|
83
80
|
headers?: MiniProgramNetworkHeaders;
|
|
84
81
|
timeout?: number;
|
|
85
|
-
withCredentials?: boolean;
|
|
86
82
|
}
|
|
87
83
|
/**
|
|
88
84
|
* bridge / runtime 返回的标准化 HTTP 响应。
|
|
@@ -114,6 +110,7 @@ export interface MiniProgramNetworkModule {
|
|
|
114
110
|
* @returns 标准化网络响应;HTTP 2xx 默认返回 resolve。
|
|
115
111
|
* @throws 当请求已完成但 HTTP 状态不满足 `validateStatus` 时抛出 `HbMiniProgramNetworkError`。
|
|
116
112
|
* @throws 当 bridge、运行时或宿主能力调用失败时抛出 `HbMiniProgramSDKError`。
|
|
113
|
+
* @deprecated Since 0.8.1-alpha.7. 暂无替代接口;现有调用仍可使用,请移除 withCredentials 配置。Native Cookie 由 Host 按目标域名决定。
|
|
117
114
|
* @since 0.2.0-alpha.0
|
|
118
115
|
* @hbPlatform android
|
|
119
116
|
* @hbPlatform ios
|