@heybox/hb-sdk 0.8.1-alpha.14 → 0.8.1-alpha.16

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +13 -0
  3. package/dist/cli-chunks/{build-D-VaxzAE.cjs → build-D3JxmtmD.cjs} +17 -7
  4. package/dist/cli-chunks/{context-BH7BZPoY.cjs → context-CcJDF3v_.cjs} +2 -2
  5. package/dist/cli-chunks/{create-Bmp9E1n8.cjs → create-Cww0mYrn.cjs} +1 -1
  6. package/dist/cli-chunks/{dev-BntAFyWR.cjs → dev-Dd2_LjFP.cjs} +9 -9
  7. package/dist/cli-chunks/{doctor-t3YMD3qv.cjs → doctor-DTDwA9UZ.cjs} +1 -1
  8. package/dist/cli-chunks/{index-VP8boR-7.cjs → index-B5jxW7GS.cjs} +15 -15
  9. package/dist/cli-chunks/{index-CjP8Qye_.cjs → index-BKbdNtX4.cjs} +2 -2
  10. package/dist/cli-chunks/{index.esm-B_5UnniK.cjs → index.esm-DxT8YC2x.cjs} +7 -7
  11. package/dist/cli-chunks/{login-p38-WSHx.cjs → login-BZEWhweM.cjs} +2 -2
  12. package/dist/cli-chunks/{project-vite-BfJ5TGoA.cjs → project-vite-DpQOovxh.cjs} +1 -1
  13. package/dist/cli-chunks/{remote-CBH04z6v.cjs → remote-zyWYZ-W8.cjs} +69 -10
  14. package/dist/cli-chunks/{runtime-permission-env-CVYOOxPB.cjs → runtime-permission-env-C7QvBZp0.cjs} +38 -1
  15. package/dist/cli-chunks/{session-BEpV8CZQ.cjs → session-DN0ZLQC2.cjs} +1 -1
  16. package/dist/cli-chunks/{skill-DuVDTrA2.cjs → skill-lsh9bXs0.cjs} +2 -2
  17. package/dist/cli-chunks/{version-Df-F-uhW.cjs → version-CoWxDzB4.cjs} +1 -1
  18. package/dist/cli.cjs +1 -1
  19. package/dist/devtools/browser-dev-host/assets/browser-dev-host-BgW__pJ2.js +101 -0
  20. package/dist/devtools/browser-dev-host/assets/{desktop-app-launch-C1GHFN_L.js → desktop-app-launch-CvKi6AqK.js} +1 -1
  21. package/dist/devtools/browser-dev-host/assets/{index-mfGqyKpq.js → index-BqskekK_.js} +3 -3
  22. package/dist/devtools/browser-dev-host/index.html +2 -2
  23. package/dist/index.cjs.js +1 -1
  24. package/dist/index.esm.js +1 -1
  25. package/dist/miniapp-publish.cjs.js +118 -0
  26. package/dist/miniapp-publish.esm.js +115 -1
  27. package/dist/vite.cjs.js +39 -1
  28. package/dist/vite.esm.js +39 -1
  29. package/package.json +4 -4
  30. package/skill/SKILL.md +15 -14
  31. package/skill/references/api-protocol.md +2 -2
  32. package/skill/references/api-root.md +3 -1
  33. package/skill/references/cli.md +2 -0
  34. package/skill/skill.json +5 -5
  35. package/types/miniapp-manifest/bindings.d.ts +5 -0
  36. package/types/miniapp-manifest/index.d.ts +1 -0
  37. package/types/miniapp-manifest/node.d.ts +1 -0
  38. package/types/miniapp-manifest/schema.d.ts +48 -0
  39. package/types/miniapp-publish/index.d.ts +2 -0
  40. package/dist/devtools/browser-dev-host/assets/browser-dev-host-D_nC-Zex.js +0 -101
@@ -5,8 +5,8 @@
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-mfGqyKpq.js"></script>
9
- <link rel="modulepreload" crossorigin href="/assets/desktop-app-launch-C1GHFN_L.js">
8
+ <script type="module" crossorigin src="/assets/index-BqskekK_.js"></script>
9
+ <link rel="modulepreload" crossorigin href="/assets/desktop-app-launch-CvKi6AqK.js">
10
10
  <link rel="stylesheet" crossorigin href="/assets/index-DXd5IZBz.css">
11
11
  </head>
12
12
  <body>
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.14';
838
+ : '0.8.1-alpha.16';
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']);
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.14';
834
+ : '0.8.1-alpha.16';
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']);
@@ -2785,9 +2785,123 @@ function requireSemver () {
2785
2785
 
2786
2786
  var semverExports = requireSemver();
2787
2787
 
2788
+ const MINIAPP_BIND_APP_IDS_MAX_COUNT = 20;
2789
+ function parseMiniappBindAppIds(value, options = {}) {
2790
+ const sourceLabel = options.sourceLabel ?? 'package.json#heybox.bindAppIds';
2791
+ if (value === undefined)
2792
+ return Object.freeze([]);
2793
+ if (!Array.isArray(value))
2794
+ throw new Error(`${sourceLabel} 必须是字符串数组`);
2795
+ if (value.length > MINIAPP_BIND_APP_IDS_MAX_COUNT) {
2796
+ throw new Error(`${sourceLabel} 最多包含 ${MINIAPP_BIND_APP_IDS_MAX_COUNT} 个游戏 appid`);
2797
+ }
2798
+ const seen = new Set();
2799
+ const appIds = [];
2800
+ for (const item of value) {
2801
+ if (typeof item !== 'string' || !/^[1-9]\d*$/.test(item)) {
2802
+ throw new Error(`${sourceLabel} 包含非法游戏 appid:${String(item)}`);
2803
+ }
2804
+ const numeric = Number(item);
2805
+ if (!Number.isSafeInteger(numeric) || numeric > 2_147_483_647) {
2806
+ throw new Error(`${sourceLabel} 包含超出正 int32 范围的游戏 appid:${item}`);
2807
+ }
2808
+ if (seen.has(item))
2809
+ throw new Error(`${sourceLabel} 包含重复游戏 appid:${item}`);
2810
+ seen.add(item);
2811
+ appIds.push(item);
2812
+ }
2813
+ appIds.sort((left, right) => Number(left) - Number(right));
2814
+ return Object.freeze(appIds);
2815
+ }
2816
+
2817
+ const MINIAPP_PLATFORM_VALUES = ['android', 'ios', 'ohos', 'windows', 'macos', 'linux'];
2818
+ /** 平台声明硬切点:产物 hb-sdk 版本达到该值时,必须显式声明非空 `platforms`。 */
2819
+ const MINIAPP_PLATFORM_HARD_CUT_SDK_VERSION = '0.9.0';
2820
+ /**
2821
+ * 历史移动端兼容平台集合。
2822
+ *
2823
+ * @remarks
2824
+ * 仅在 `sdkVersion` 缺失或 SemVer precedence 低于 `MINIAPP_PLATFORM_HARD_CUT_SDK_VERSION`,
2825
+ * 且 Manifest 完全没有 `platforms` 字段时生效,不是任何非法声明的兜底。
2826
+ */
2827
+ const MINIAPP_LEGACY_MOBILE_PLATFORM_VALUES = ['android', 'ios', 'ohos'];
2788
2828
  function isValidMiniappManifestVersion(version) {
2789
2829
  return getMiniappManifestVersionError(version) === undefined;
2790
2830
  }
2831
+ function validateMiniappPlatforms(platforms, sourceLabel = 'platforms') {
2832
+ if (!Array.isArray(platforms) || platforms.length === 0) {
2833
+ throw new Error(`${sourceLabel} 必须是非空平台数组`);
2834
+ }
2835
+ const allowedPlatforms = new Set(MINIAPP_PLATFORM_VALUES);
2836
+ const seen = new Set();
2837
+ for (const platform of platforms) {
2838
+ if (typeof platform !== 'string' || !allowedPlatforms.has(platform)) {
2839
+ throw new Error(`${sourceLabel} 包含不支持的平台:${String(platform)}`);
2840
+ }
2841
+ if (seen.has(platform)) {
2842
+ throw new Error(`${sourceLabel} 包含重复平台:${platform}`);
2843
+ }
2844
+ seen.add(platform);
2845
+ }
2846
+ return Object.freeze(MINIAPP_PLATFORM_VALUES.filter((platform) => seen.has(platform)));
2847
+ }
2848
+ const NO_MINIAPP_PLATFORMS = Object.freeze([]);
2849
+ /**
2850
+ * 解析 Manifest 平台声明,是 `0.9.0` 硬切规则的唯一实现。
2851
+ *
2852
+ * @remarks
2853
+ * 规则与后端领域层保持一致:
2854
+ * - 无 `platforms` 字段:`sdkVersion` 缺失或 SemVer precedence 低于
2855
+ * `MINIAPP_PLATFORM_HARD_CUT_SDK_VERSION` 时按历史移动端兼容;达到或高于硬切点即非法。
2856
+ * - 有 `platforms` 字段:复用 `validateMiniappPlatforms` 校验并规范化顺序;任何非法值
2857
+ * (空数组、非数组、未知值、重复值)都不回退到历史兼容,即使 `sdkVersion < 0.9.0`。
2858
+ * - 任何非法的 `sdkVersion` 都会抛出,不做字符串比较。
2859
+ * @param sdkVersion - 产物 hb-sdk 版本;历史产物可能缺失。
2860
+ * @param manifest - 待解析的 Manifest(不可信输入)。
2861
+ * @returns 冻结的平台解析结果。
2862
+ * @throws Manifest 不是对象、`sdkVersion` 不是合法 SemVer、达到硬切点仍缺失 `platforms`,
2863
+ * 或 `platforms` 声明非法时抛出。
2864
+ */
2865
+ function resolveMiniappManifestPlatforms(sdkVersion, manifest) {
2866
+ if (!isRecord$1(manifest)) {
2867
+ throw new Error('manifest 必须是 JSON 对象');
2868
+ }
2869
+ // 与后端 ResolvePlatforms 对齐:空串/纯空白按“缺失 SDK 版本”处理(历史产物),不报错。
2870
+ const trimmedSdkVersion = typeof sdkVersion === 'string' ? sdkVersion.trim() : undefined;
2871
+ const normalizedSdkVersion = trimmedSdkVersion ? validateSdkVersion(trimmedSdkVersion) : undefined;
2872
+ if (Object.prototype.hasOwnProperty.call(manifest, 'platforms')) {
2873
+ const platforms = validateMiniappPlatforms(manifest.platforms, 'manifest.platforms');
2874
+ return Object.freeze({
2875
+ declared: platforms,
2876
+ effective: platforms,
2877
+ platformsDeclared: true,
2878
+ policy: 'explicit',
2879
+ });
2880
+ }
2881
+ if (normalizedSdkVersion === undefined || semverExports.lt(normalizedSdkVersion, MINIAPP_PLATFORM_HARD_CUT_SDK_VERSION)) {
2882
+ return Object.freeze({
2883
+ declared: NO_MINIAPP_PLATFORMS,
2884
+ effective: MINIAPP_LEGACY_MOBILE_PLATFORM_VALUES,
2885
+ platformsDeclared: false,
2886
+ policy: 'legacy_mobile_default',
2887
+ });
2888
+ }
2889
+ throw new Error(`manifest.platforms 缺失:hb-sdk ${MINIAPP_PLATFORM_HARD_CUT_SDK_VERSION} 起必须显式声明非空 platforms(当前 ${normalizedSdkVersion})`);
2890
+ }
2891
+ function validateSdkVersion(version, sourceLabel = 'sdkVersion') {
2892
+ if (typeof version !== 'string' || version.trim() === '') {
2893
+ throw new Error(`${sourceLabel} 必须是合法 SemVer:${String(version)}`);
2894
+ }
2895
+ const normalized = version.trim();
2896
+ const parsed = semverExports.parse(normalized);
2897
+ if (!parsed || parsed.version !== normalized || parsed.build.length > 0) {
2898
+ throw new Error(`${sourceLabel} 必须是合法 SemVer:${normalized}`);
2899
+ }
2900
+ return normalized;
2901
+ }
2902
+ function isRecord$1(value) {
2903
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
2904
+ }
2791
2905
  function getMiniappManifestVersionError(version) {
2792
2906
  if (typeof version !== 'string' || version.trim() === '') {
2793
2907
  return `必须是合法 SemVer:${String(version)}`;
@@ -3202,6 +3316,8 @@ exports.LIST_USER_MINIPROGRAM_API_PATH = LIST_USER_MINIPROGRAM_API_PATH;
3202
3316
  exports.LIST_USER_MINIPROGRAM_LEADERBOARD_API_PATH = LIST_USER_MINIPROGRAM_LEADERBOARD_API_PATH;
3203
3317
  exports.LIST_USER_MINIPROGRAM_VERSION_API_PATH = LIST_USER_MINIPROGRAM_VERSION_API_PATH;
3204
3318
  exports.MINIAPP_COMPANION_UPLOAD_TEMPORARY_SIZE_LIMIT_BYTES = MINIAPP_COMPANION_UPLOAD_TEMPORARY_SIZE_LIMIT_BYTES;
3319
+ exports.MINIAPP_LEGACY_MOBILE_PLATFORM_VALUES = MINIAPP_LEGACY_MOBILE_PLATFORM_VALUES;
3320
+ exports.MINIAPP_PLATFORM_HARD_CUT_SDK_VERSION = MINIAPP_PLATFORM_HARD_CUT_SDK_VERSION;
3205
3321
  exports.MINIAPP_UPLOAD_BATCH_SIZE = MINIAPP_UPLOAD_BATCH_SIZE;
3206
3322
  exports.MINIAPP_UPLOAD_SCOPE = MINIAPP_UPLOAD_SCOPE;
3207
3323
  exports.MINIAPP_UPLOAD_TOTAL_SIZE_LIMIT_BYTES = MINIAPP_UPLOAD_TOTAL_SIZE_LIMIT_BYTES;
@@ -3222,8 +3338,10 @@ exports.getMiniProgramUploadAlias = getMiniProgramUploadAlias;
3222
3338
  exports.getMiniappUploadKey = getMiniappUploadKey;
3223
3339
  exports.isValidVersion = isValidMiniappManifestVersion;
3224
3340
  exports.normalizeRelativePath = normalizeRelativePath;
3341
+ exports.parseMiniappBindAppIds = parseMiniappBindAppIds;
3225
3342
  exports.prepareMiniappArtifactFiles = prepareMiniappArtifactFiles;
3226
3343
  exports.relativePathContainsNodeModulesSegment = relativePathContainsNodeModulesSegment;
3344
+ exports.resolveMiniappManifestPlatforms = resolveMiniappManifestPlatforms;
3227
3345
  exports.resolveMiniappUploadSessionFiles = resolveMiniappUploadSessionFiles;
3228
3346
  exports.shouldUploadDistFile = shouldUploadDistFile;
3229
3347
  exports.validateMiniappCompanionFileReceipts = validateMiniappCompanionFileReceipts;
@@ -2783,9 +2783,123 @@ function requireSemver () {
2783
2783
 
2784
2784
  var semverExports = requireSemver();
2785
2785
 
2786
+ const MINIAPP_BIND_APP_IDS_MAX_COUNT = 20;
2787
+ function parseMiniappBindAppIds(value, options = {}) {
2788
+ const sourceLabel = options.sourceLabel ?? 'package.json#heybox.bindAppIds';
2789
+ if (value === undefined)
2790
+ return Object.freeze([]);
2791
+ if (!Array.isArray(value))
2792
+ throw new Error(`${sourceLabel} 必须是字符串数组`);
2793
+ if (value.length > MINIAPP_BIND_APP_IDS_MAX_COUNT) {
2794
+ throw new Error(`${sourceLabel} 最多包含 ${MINIAPP_BIND_APP_IDS_MAX_COUNT} 个游戏 appid`);
2795
+ }
2796
+ const seen = new Set();
2797
+ const appIds = [];
2798
+ for (const item of value) {
2799
+ if (typeof item !== 'string' || !/^[1-9]\d*$/.test(item)) {
2800
+ throw new Error(`${sourceLabel} 包含非法游戏 appid:${String(item)}`);
2801
+ }
2802
+ const numeric = Number(item);
2803
+ if (!Number.isSafeInteger(numeric) || numeric > 2_147_483_647) {
2804
+ throw new Error(`${sourceLabel} 包含超出正 int32 范围的游戏 appid:${item}`);
2805
+ }
2806
+ if (seen.has(item))
2807
+ throw new Error(`${sourceLabel} 包含重复游戏 appid:${item}`);
2808
+ seen.add(item);
2809
+ appIds.push(item);
2810
+ }
2811
+ appIds.sort((left, right) => Number(left) - Number(right));
2812
+ return Object.freeze(appIds);
2813
+ }
2814
+
2815
+ const MINIAPP_PLATFORM_VALUES = ['android', 'ios', 'ohos', 'windows', 'macos', 'linux'];
2816
+ /** 平台声明硬切点:产物 hb-sdk 版本达到该值时,必须显式声明非空 `platforms`。 */
2817
+ const MINIAPP_PLATFORM_HARD_CUT_SDK_VERSION = '0.9.0';
2818
+ /**
2819
+ * 历史移动端兼容平台集合。
2820
+ *
2821
+ * @remarks
2822
+ * 仅在 `sdkVersion` 缺失或 SemVer precedence 低于 `MINIAPP_PLATFORM_HARD_CUT_SDK_VERSION`,
2823
+ * 且 Manifest 完全没有 `platforms` 字段时生效,不是任何非法声明的兜底。
2824
+ */
2825
+ const MINIAPP_LEGACY_MOBILE_PLATFORM_VALUES = ['android', 'ios', 'ohos'];
2786
2826
  function isValidMiniappManifestVersion(version) {
2787
2827
  return getMiniappManifestVersionError(version) === undefined;
2788
2828
  }
2829
+ function validateMiniappPlatforms(platforms, sourceLabel = 'platforms') {
2830
+ if (!Array.isArray(platforms) || platforms.length === 0) {
2831
+ throw new Error(`${sourceLabel} 必须是非空平台数组`);
2832
+ }
2833
+ const allowedPlatforms = new Set(MINIAPP_PLATFORM_VALUES);
2834
+ const seen = new Set();
2835
+ for (const platform of platforms) {
2836
+ if (typeof platform !== 'string' || !allowedPlatforms.has(platform)) {
2837
+ throw new Error(`${sourceLabel} 包含不支持的平台:${String(platform)}`);
2838
+ }
2839
+ if (seen.has(platform)) {
2840
+ throw new Error(`${sourceLabel} 包含重复平台:${platform}`);
2841
+ }
2842
+ seen.add(platform);
2843
+ }
2844
+ return Object.freeze(MINIAPP_PLATFORM_VALUES.filter((platform) => seen.has(platform)));
2845
+ }
2846
+ const NO_MINIAPP_PLATFORMS = Object.freeze([]);
2847
+ /**
2848
+ * 解析 Manifest 平台声明,是 `0.9.0` 硬切规则的唯一实现。
2849
+ *
2850
+ * @remarks
2851
+ * 规则与后端领域层保持一致:
2852
+ * - 无 `platforms` 字段:`sdkVersion` 缺失或 SemVer precedence 低于
2853
+ * `MINIAPP_PLATFORM_HARD_CUT_SDK_VERSION` 时按历史移动端兼容;达到或高于硬切点即非法。
2854
+ * - 有 `platforms` 字段:复用 `validateMiniappPlatforms` 校验并规范化顺序;任何非法值
2855
+ * (空数组、非数组、未知值、重复值)都不回退到历史兼容,即使 `sdkVersion < 0.9.0`。
2856
+ * - 任何非法的 `sdkVersion` 都会抛出,不做字符串比较。
2857
+ * @param sdkVersion - 产物 hb-sdk 版本;历史产物可能缺失。
2858
+ * @param manifest - 待解析的 Manifest(不可信输入)。
2859
+ * @returns 冻结的平台解析结果。
2860
+ * @throws Manifest 不是对象、`sdkVersion` 不是合法 SemVer、达到硬切点仍缺失 `platforms`,
2861
+ * 或 `platforms` 声明非法时抛出。
2862
+ */
2863
+ function resolveMiniappManifestPlatforms(sdkVersion, manifest) {
2864
+ if (!isRecord$1(manifest)) {
2865
+ throw new Error('manifest 必须是 JSON 对象');
2866
+ }
2867
+ // 与后端 ResolvePlatforms 对齐:空串/纯空白按“缺失 SDK 版本”处理(历史产物),不报错。
2868
+ const trimmedSdkVersion = typeof sdkVersion === 'string' ? sdkVersion.trim() : undefined;
2869
+ const normalizedSdkVersion = trimmedSdkVersion ? validateSdkVersion(trimmedSdkVersion) : undefined;
2870
+ if (Object.prototype.hasOwnProperty.call(manifest, 'platforms')) {
2871
+ const platforms = validateMiniappPlatforms(manifest.platforms, 'manifest.platforms');
2872
+ return Object.freeze({
2873
+ declared: platforms,
2874
+ effective: platforms,
2875
+ platformsDeclared: true,
2876
+ policy: 'explicit',
2877
+ });
2878
+ }
2879
+ if (normalizedSdkVersion === undefined || semverExports.lt(normalizedSdkVersion, MINIAPP_PLATFORM_HARD_CUT_SDK_VERSION)) {
2880
+ return Object.freeze({
2881
+ declared: NO_MINIAPP_PLATFORMS,
2882
+ effective: MINIAPP_LEGACY_MOBILE_PLATFORM_VALUES,
2883
+ platformsDeclared: false,
2884
+ policy: 'legacy_mobile_default',
2885
+ });
2886
+ }
2887
+ throw new Error(`manifest.platforms 缺失:hb-sdk ${MINIAPP_PLATFORM_HARD_CUT_SDK_VERSION} 起必须显式声明非空 platforms(当前 ${normalizedSdkVersion})`);
2888
+ }
2889
+ function validateSdkVersion(version, sourceLabel = 'sdkVersion') {
2890
+ if (typeof version !== 'string' || version.trim() === '') {
2891
+ throw new Error(`${sourceLabel} 必须是合法 SemVer:${String(version)}`);
2892
+ }
2893
+ const normalized = version.trim();
2894
+ const parsed = semverExports.parse(normalized);
2895
+ if (!parsed || parsed.version !== normalized || parsed.build.length > 0) {
2896
+ throw new Error(`${sourceLabel} 必须是合法 SemVer:${normalized}`);
2897
+ }
2898
+ return normalized;
2899
+ }
2900
+ function isRecord$1(value) {
2901
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
2902
+ }
2789
2903
  function getMiniappManifestVersionError(version) {
2790
2904
  if (typeof version !== 'string' || version.trim() === '') {
2791
2905
  return `必须是合法 SemVer:${String(version)}`;
@@ -3187,4 +3301,4 @@ function compareBytes(left, right) {
3187
3301
  return left.length - right.length;
3188
3302
  }
3189
3303
 
3190
- export { ACTIVITY_UPLOAD_KEY_MAX_LENGTH, CREATE_USER_MINIPROGRAM_API_PATH, CREATE_USER_MINIPROGRAM_LEADERBOARD_API_PATH, CREATE_USER_MINIPROGRAM_LOCAL_DEV_LAUNCH_TOKEN_API_PATH, DELETE_USER_MINIPROGRAM_LEADERBOARD_API_PATH, DETAIL_USER_MINIPROGRAM_API_PATH, DETAIL_USER_MINIPROGRAM_LEADERBOARD_API_PATH, DEVELOPER_ENTITY_LIST_API_PATH, DEVELOPER_ENTITY_SWITCH_API_PATH, LIST_USER_MINIPROGRAM_API_PATH, LIST_USER_MINIPROGRAM_LEADERBOARD_API_PATH, LIST_USER_MINIPROGRAM_VERSION_API_PATH, MINIAPP_COMPANION_UPLOAD_TEMPORARY_SIZE_LIMIT_BYTES, MINIAPP_UPLOAD_BATCH_SIZE, MINIAPP_UPLOAD_SCOPE, MINIAPP_UPLOAD_TOTAL_SIZE_LIMIT_BYTES, PRECHECK_USER_MINIPROGRAM_VERSION_API_PATH, RELEASE_USER_MINIPROGRAM_VERSION_API_PATH, REOPEN_USER_MINIPROGRAM_API_PATH, SUBMIT_USER_MINIPROGRAM_AUDIT_API_PATH, TAKE_DOWN_USER_MINIPROGRAM_API_PATH, UPDATE_SQUARE_DISPLAY_API_PATH, UPDATE_USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH, USER_MINIPROGRAM_ACCESS_STATUS_API_PATH, USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH, USER_MINIPROGRAM_VERSION_PREVIEW_INFO_API_PATH, WITHDRAW_USER_MINIPROGRAM_VERSION_API_PATH, createMiniappArtifactFileHeader, createMiniappArtifactSignatureHeader, getMiniProgramUploadAlias, getMiniappUploadKey, isValidMiniappManifestVersion as isValidVersion, normalizeRelativePath, prepareMiniappArtifactFiles, relativePathContainsNodeModulesSegment, resolveMiniappUploadSessionFiles, shouldUploadDistFile, validateMiniappCompanionFileReceipts, validateMiniappUploadPathLengths, validateMiniappUploadSizeBudgets, validateUploadPaths, validateUploadTotalSize };
3304
+ export { ACTIVITY_UPLOAD_KEY_MAX_LENGTH, CREATE_USER_MINIPROGRAM_API_PATH, CREATE_USER_MINIPROGRAM_LEADERBOARD_API_PATH, CREATE_USER_MINIPROGRAM_LOCAL_DEV_LAUNCH_TOKEN_API_PATH, DELETE_USER_MINIPROGRAM_LEADERBOARD_API_PATH, DETAIL_USER_MINIPROGRAM_API_PATH, DETAIL_USER_MINIPROGRAM_LEADERBOARD_API_PATH, DEVELOPER_ENTITY_LIST_API_PATH, DEVELOPER_ENTITY_SWITCH_API_PATH, LIST_USER_MINIPROGRAM_API_PATH, LIST_USER_MINIPROGRAM_LEADERBOARD_API_PATH, LIST_USER_MINIPROGRAM_VERSION_API_PATH, MINIAPP_COMPANION_UPLOAD_TEMPORARY_SIZE_LIMIT_BYTES, MINIAPP_LEGACY_MOBILE_PLATFORM_VALUES, MINIAPP_PLATFORM_HARD_CUT_SDK_VERSION, MINIAPP_UPLOAD_BATCH_SIZE, MINIAPP_UPLOAD_SCOPE, MINIAPP_UPLOAD_TOTAL_SIZE_LIMIT_BYTES, PRECHECK_USER_MINIPROGRAM_VERSION_API_PATH, RELEASE_USER_MINIPROGRAM_VERSION_API_PATH, REOPEN_USER_MINIPROGRAM_API_PATH, SUBMIT_USER_MINIPROGRAM_AUDIT_API_PATH, TAKE_DOWN_USER_MINIPROGRAM_API_PATH, UPDATE_SQUARE_DISPLAY_API_PATH, UPDATE_USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH, USER_MINIPROGRAM_ACCESS_STATUS_API_PATH, USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH, USER_MINIPROGRAM_VERSION_PREVIEW_INFO_API_PATH, WITHDRAW_USER_MINIPROGRAM_VERSION_API_PATH, createMiniappArtifactFileHeader, createMiniappArtifactSignatureHeader, getMiniProgramUploadAlias, getMiniappUploadKey, isValidMiniappManifestVersion as isValidVersion, normalizeRelativePath, parseMiniappBindAppIds, prepareMiniappArtifactFiles, relativePathContainsNodeModulesSegment, resolveMiniappManifestPlatforms, resolveMiniappUploadSessionFiles, shouldUploadDistFile, validateMiniappCompanionFileReceipts, validateMiniappUploadPathLengths, validateMiniappUploadSizeBudgets, validateUploadPaths, validateUploadTotalSize };
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';
14
+ : '0.8.1-alpha.16';
15
15
 
16
16
  /**
17
17
  * iframe 与调试台页面的开发期 console 捕获转发。
@@ -3116,6 +3116,35 @@ function requireSemver () {
3116
3116
 
3117
3117
  var semverExports = requireSemver();
3118
3118
 
3119
+ const MINIAPP_BIND_APP_IDS_MAX_COUNT = 20;
3120
+ function parseMiniappBindAppIds(value, options = {}) {
3121
+ const sourceLabel = options.sourceLabel ?? 'package.json#heybox.bindAppIds';
3122
+ if (value === undefined)
3123
+ return Object.freeze([]);
3124
+ if (!Array.isArray(value))
3125
+ throw new Error(`${sourceLabel} 必须是字符串数组`);
3126
+ if (value.length > MINIAPP_BIND_APP_IDS_MAX_COUNT) {
3127
+ throw new Error(`${sourceLabel} 最多包含 ${MINIAPP_BIND_APP_IDS_MAX_COUNT} 个游戏 appid`);
3128
+ }
3129
+ const seen = new Set();
3130
+ const appIds = [];
3131
+ for (const item of value) {
3132
+ if (typeof item !== 'string' || !/^[1-9]\d*$/.test(item)) {
3133
+ throw new Error(`${sourceLabel} 包含非法游戏 appid:${String(item)}`);
3134
+ }
3135
+ const numeric = Number(item);
3136
+ if (!Number.isSafeInteger(numeric) || numeric > 2_147_483_647) {
3137
+ throw new Error(`${sourceLabel} 包含超出正 int32 范围的游戏 appid:${item}`);
3138
+ }
3139
+ if (seen.has(item))
3140
+ throw new Error(`${sourceLabel} 包含重复游戏 appid:${item}`);
3141
+ seen.add(item);
3142
+ appIds.push(item);
3143
+ }
3144
+ appIds.sort((left, right) => Number(left) - Number(right));
3145
+ return Object.freeze(appIds);
3146
+ }
3147
+
3119
3148
  const MINI_PROGRAM_MESSAGE_NAMESPACE = 'heybox:miniprogram';
3120
3149
  const MINI_PROGRAM_MESSAGE_VERSION = 2;
3121
3150
  const MINI_PROGRAM_BRIDGE_NONCE_PARAM = 'hb_mini_bridge_nonce';
@@ -3351,6 +3380,7 @@ function validateMiniappManifestVersion(version, sourceLabel = 'manifest.version
3351
3380
  function renderMiniappManifest(manifest) {
3352
3381
  const platforms = validateMiniappPlatforms(manifest.platforms, 'manifest.platforms');
3353
3382
  const window = validateMiniappWindow(manifest.window, 'manifest.window');
3383
+ const bindAppIds = parseMiniappBindAppIds(manifest.bindAppIds, { sourceLabel: 'manifest.bindAppIds' });
3354
3384
  const output = {
3355
3385
  version: manifest.version,
3356
3386
  sdkVersion: manifest.sdkVersion,
@@ -3358,6 +3388,7 @@ function renderMiniappManifest(manifest) {
3358
3388
  ...(manifest.permissions === undefined ? {} : { permissions: manifest.permissions }),
3359
3389
  ...(manifest.companions === undefined ? {} : { companions: manifest.companions }),
3360
3390
  ...(window === undefined ? {} : { window }),
3391
+ ...(bindAppIds.length === 0 ? {} : { bindAppIds }),
3361
3392
  };
3362
3393
  return `${JSON.stringify(output, null, 2)}\n`;
3363
3394
  }
@@ -3519,6 +3550,11 @@ function readMiniappPermissionsFromPackageJson(root, sdkVersion) {
3519
3550
  sdkVersion,
3520
3551
  });
3521
3552
  }
3553
+ function readMiniappBindAppIdsFromPackageJson(root) {
3554
+ const { packageJson } = readMiniappPackageJson(root, false);
3555
+ const heybox = readMiniappHeyboxConfig(packageJson);
3556
+ return parseMiniappBindAppIds(heybox?.bindAppIds);
3557
+ }
3522
3558
  function readMiniappPackageJson(root, requireVersion) {
3523
3559
  const packageJsonPath = findNearestPackageJsonPath(root);
3524
3560
  let content;
@@ -13302,6 +13338,7 @@ function miniappManifest() {
13302
13338
  const windowDeclaration = readMiniappWindowFromPackageJson(root);
13303
13339
  const companionConfig = readMiniappCompanionsFromPackageJson(root);
13304
13340
  const companionDeclarations = includeCompanions ? companionConfig.declarations : undefined;
13341
+ const bindAppIds = readMiniappBindAppIdsFromPackageJson(root);
13305
13342
  if (!parsedPermissions.declared)
13306
13343
  this.warn(getMissingPermissionsWarning());
13307
13344
  if (companionDeclarations && !parsedPermissions.permissions?.companion) {
@@ -13330,6 +13367,7 @@ function miniappManifest() {
13330
13367
  ...(parsedPermissions.permissions === undefined ? {} : { permissions: parsedPermissions.permissions }),
13331
13368
  ...(companions === undefined ? {} : { companions }),
13332
13369
  ...(windowDeclaration === undefined ? {} : { window: windowDeclaration }),
13370
+ ...(bindAppIds.length === 0 ? {} : { bindAppIds }),
13333
13371
  }));
13334
13372
  },
13335
13373
  };
package/dist/vite.esm.js CHANGED
@@ -8,7 +8,7 @@ import { AsyncLocalStorage } from 'node:async_hooks';
8
8
  /** 构建时替换为当前发布包的实际版本。 */
9
9
  const HB_SDK_VERSION = typeof undefined === 'string'
10
10
  ? undefined
11
- : '0.8.1-alpha.14';
11
+ : '0.8.1-alpha.16';
12
12
 
13
13
  /**
14
14
  * iframe 与调试台页面的开发期 console 捕获转发。
@@ -3113,6 +3113,35 @@ function requireSemver () {
3113
3113
 
3114
3114
  var semverExports = requireSemver();
3115
3115
 
3116
+ const MINIAPP_BIND_APP_IDS_MAX_COUNT = 20;
3117
+ function parseMiniappBindAppIds(value, options = {}) {
3118
+ const sourceLabel = options.sourceLabel ?? 'package.json#heybox.bindAppIds';
3119
+ if (value === undefined)
3120
+ return Object.freeze([]);
3121
+ if (!Array.isArray(value))
3122
+ throw new Error(`${sourceLabel} 必须是字符串数组`);
3123
+ if (value.length > MINIAPP_BIND_APP_IDS_MAX_COUNT) {
3124
+ throw new Error(`${sourceLabel} 最多包含 ${MINIAPP_BIND_APP_IDS_MAX_COUNT} 个游戏 appid`);
3125
+ }
3126
+ const seen = new Set();
3127
+ const appIds = [];
3128
+ for (const item of value) {
3129
+ if (typeof item !== 'string' || !/^[1-9]\d*$/.test(item)) {
3130
+ throw new Error(`${sourceLabel} 包含非法游戏 appid:${String(item)}`);
3131
+ }
3132
+ const numeric = Number(item);
3133
+ if (!Number.isSafeInteger(numeric) || numeric > 2_147_483_647) {
3134
+ throw new Error(`${sourceLabel} 包含超出正 int32 范围的游戏 appid:${item}`);
3135
+ }
3136
+ if (seen.has(item))
3137
+ throw new Error(`${sourceLabel} 包含重复游戏 appid:${item}`);
3138
+ seen.add(item);
3139
+ appIds.push(item);
3140
+ }
3141
+ appIds.sort((left, right) => Number(left) - Number(right));
3142
+ return Object.freeze(appIds);
3143
+ }
3144
+
3116
3145
  const MINI_PROGRAM_MESSAGE_NAMESPACE = 'heybox:miniprogram';
3117
3146
  const MINI_PROGRAM_MESSAGE_VERSION = 2;
3118
3147
  const MINI_PROGRAM_BRIDGE_NONCE_PARAM = 'hb_mini_bridge_nonce';
@@ -3348,6 +3377,7 @@ function validateMiniappManifestVersion(version, sourceLabel = 'manifest.version
3348
3377
  function renderMiniappManifest(manifest) {
3349
3378
  const platforms = validateMiniappPlatforms(manifest.platforms, 'manifest.platforms');
3350
3379
  const window = validateMiniappWindow(manifest.window, 'manifest.window');
3380
+ const bindAppIds = parseMiniappBindAppIds(manifest.bindAppIds, { sourceLabel: 'manifest.bindAppIds' });
3351
3381
  const output = {
3352
3382
  version: manifest.version,
3353
3383
  sdkVersion: manifest.sdkVersion,
@@ -3355,6 +3385,7 @@ function renderMiniappManifest(manifest) {
3355
3385
  ...(manifest.permissions === undefined ? {} : { permissions: manifest.permissions }),
3356
3386
  ...(manifest.companions === undefined ? {} : { companions: manifest.companions }),
3357
3387
  ...(window === undefined ? {} : { window }),
3388
+ ...(bindAppIds.length === 0 ? {} : { bindAppIds }),
3358
3389
  };
3359
3390
  return `${JSON.stringify(output, null, 2)}\n`;
3360
3391
  }
@@ -3516,6 +3547,11 @@ function readMiniappPermissionsFromPackageJson(root, sdkVersion) {
3516
3547
  sdkVersion,
3517
3548
  });
3518
3549
  }
3550
+ function readMiniappBindAppIdsFromPackageJson(root) {
3551
+ const { packageJson } = readMiniappPackageJson(root, false);
3552
+ const heybox = readMiniappHeyboxConfig(packageJson);
3553
+ return parseMiniappBindAppIds(heybox?.bindAppIds);
3554
+ }
3519
3555
  function readMiniappPackageJson(root, requireVersion) {
3520
3556
  const packageJsonPath = findNearestPackageJsonPath(root);
3521
3557
  let content;
@@ -13299,6 +13335,7 @@ function miniappManifest() {
13299
13335
  const windowDeclaration = readMiniappWindowFromPackageJson(root);
13300
13336
  const companionConfig = readMiniappCompanionsFromPackageJson(root);
13301
13337
  const companionDeclarations = includeCompanions ? companionConfig.declarations : undefined;
13338
+ const bindAppIds = readMiniappBindAppIdsFromPackageJson(root);
13302
13339
  if (!parsedPermissions.declared)
13303
13340
  this.warn(getMissingPermissionsWarning());
13304
13341
  if (companionDeclarations && !parsedPermissions.permissions?.companion) {
@@ -13327,6 +13364,7 @@ function miniappManifest() {
13327
13364
  ...(parsedPermissions.permissions === undefined ? {} : { permissions: parsedPermissions.permissions }),
13328
13365
  ...(companions === undefined ? {} : { companions }),
13329
13366
  ...(windowDeclaration === undefined ? {} : { window: windowDeclaration }),
13367
+ ...(bindAppIds.length === 0 ? {} : { bindAppIds }),
13330
13368
  }));
13331
13369
  },
13332
13370
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heybox/hb-sdk",
3
- "version": "0.8.1-alpha.14",
3
+ "version": "0.8.1-alpha.16",
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.14"
65
+ "@heybox/hb-sdk-protocol": "0.8.1-alpha.16"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "vite": ">=5"
@@ -113,9 +113,9 @@
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-domain/heybox-vue3-ui": "~0.1.0",
118
- "@heybox/hb-sdk-runtime": "~0.8.1-alpha.14",
117
+ "@heybox-domain/heybox-theme": "~0.1.0",
118
+ "@heybox/hb-sdk-runtime": "~0.8.1-alpha.16",
119
119
  "@heybox/hb-api": "~1.28.3",
120
120
  "@heybox/runtime": "~0.2.0",
121
121
  "@heybox/runtime-policy": "~0.2.0",
package/skill/SKILL.md CHANGED
@@ -66,20 +66,21 @@ Apply these instructions when writing, reviewing, or debugging code that consume
66
66
  For real PC Companion debugging, configure local artifacts in `package.json#heybox.companions`, keep `miniappManifest()` enabled, bind the project, and ensure COA has approved `companion`. `hb-sdk dev` validates immutable snapshots without requiring an upload; config or artifact changes rotate the snapshot while existing Sessions retain their original artifact. Prepare and launch the new artifact explicitly. Check separate Browser, Mobile and PC Companion readiness in the debugging workbench. Without a local declaration, use Browser Fake only for state/UI integration.
67
67
  4. Use `hb-sdk build [--env <name>] [--verbose]` as the recommended production build entry. It directly owns the Vite build, always cleans and writes `dist/`, and works without CLI login, project binding, or network access.
68
68
  5. Declare the actual supported platforms in `package.json#heybox.platforms` and keep the no-argument `miniappManifest()` explicitly enabled in `vite.config.ts`; `hb-sdk build` must fail when the declaration, Manifest, or Runtime gate output is missing or inconsistent.
69
- 6. Keep project typechecking in `scripts.build`, for example `vue-tsc --noEmit && hb-sdk build`; `hb-sdk build` does not run typechecking or invoke `scripts.build` itself.
70
- 7. Existing projects may continue to use `vite build`; do not auto-migrate them. Do not invent `--mode`, `--json`, config, or output-directory flags for `hb-sdk build`.
71
- 8. Use `hb-sdk login`, `hb-sdk login status`, and `hb-sdk login clear` for remote management, publishing, Mobile debugging, and optional Browser Mock Host `heybox-session` requests. Browser debugging itself can start without CLI login. Mini-program code must still call `auth.login()`; the debug page only confirms authorization. Do not paste CLI credentials into page JavaScript. Phone debugging continues to use the App login.
72
- 9. Use `hb-sdk remote entity current` to confirm the current developer account and `hb-sdk remote entity switch <entity-id>` to change it before remote operations.
73
- 10. Use `hb-sdk remote create` to create and bind a mini-program; use `hb-sdk remote bind <mini-program-id>` to bind an existing manageable mini-program.
74
- 11. Use `hb-sdk remote info`, `hb-sdk remote list`, `hb-sdk remote access`, `hb-sdk remote versions`, `hb-sdk remote preview <version>`, and `hb-sdk remote allowlist ...` for remote inspection and preview management.
75
- 12. Use `hb-sdk remote deploy --release-note <text>` to run the project's `scripts.build`, upload, and submit the current project for audit. Do not recommend the removed top-level `hb-sdk deploy` alias.
76
- 13. `hb-sdk dev` and `hb-sdk remote deploy` skip the platform CSP only when the current version declares and the platform approves `network`. `useOfficialDomain` does not participate in CSP skip decisions. Direct `hb-sdk build`, direct Vite build, anonymous or invalid snapshots, and local Dev Context overrides must keep the platform CSP. Runtime Gate, Manifest, and HTML validation always remain active.
77
- 14. After approval, use `hb-sdk remote release <version>` for manual release or `--auto-publish` when an eligible low-risk version should release automatically.
78
- 15. Treat approval, release, and public display as separate states. Do not promise square, search, or recommendation visibility after release.
79
- 16. Use `hb-sdk remote withdraw`, `hb-sdk remote take-down`, `hb-sdk remote reopen`, and square visibility commands only after showing the target and obtaining required confirmation.
80
- 17. Use `--json` for remote script consumption and `--verbose` only when concise output is insufficient for diagnosis.
81
- 18. Use `hb-sdk doctor` to diagnose whether the local Skill matches the installed SDK; follow its output to install or refresh the Skill.
82
- 19. Do not print or expose cookies, tokens, private headers, or other credentials.
69
+ 6. When a released version should be discoverable from specific PC game workspaces, declare canonical decimal string appids in `package.json#heybox.bindAppIds` (maximum 20). This is version metadata, not a Runtime permission. Missing or empty clears bindings; `--from-version` inherits the source artifact snapshot.
70
+ 7. Keep project typechecking in `scripts.build`, for example `vue-tsc --noEmit && hb-sdk build`; `hb-sdk build` does not run typechecking or invoke `scripts.build` itself.
71
+ 8. Existing projects may continue to use `vite build`; do not auto-migrate them. Do not invent `--mode`, `--json`, config, or output-directory flags for `hb-sdk build`.
72
+ 9. Use `hb-sdk login`, `hb-sdk login status`, and `hb-sdk login clear` for remote management, publishing, Mobile debugging, and optional Browser Mock Host `heybox-session` requests. Browser debugging itself can start without CLI login. Mini-program code must still call `auth.login()`; the debug page only confirms authorization. Do not paste CLI credentials into page JavaScript. Phone debugging continues to use the App login.
73
+ 10. Use `hb-sdk remote entity current` to confirm the current developer account and `hb-sdk remote entity switch <entity-id>` to change it before remote operations.
74
+ 11. Use `hb-sdk remote create` to create and bind a mini-program; use `hb-sdk remote bind <mini-program-id>` to bind an existing manageable mini-program.
75
+ 12. Use `hb-sdk remote info` to compare local/current/added/removed game bindings, and use `hb-sdk remote list`, `hb-sdk remote access`, `hb-sdk remote versions`, `hb-sdk remote preview <version>`, and `hb-sdk remote allowlist ...` for remote inspection and preview management. These commands do not edit game bindings.
76
+ 13. Use `hb-sdk remote deploy --release-note <text>` to run the project's `scripts.build`, upload, and submit the current project for audit. Do not recommend the removed top-level `hb-sdk deploy` alias.
77
+ 14. `hb-sdk dev` and `hb-sdk remote deploy` skip the platform CSP only when the current version declares and the platform approves `network`. `useOfficialDomain` does not participate in CSP skip decisions. Direct `hb-sdk build`, direct Vite build, anonymous or invalid snapshots, and local Dev Context overrides must keep the platform CSP. Runtime Gate, Manifest, and HTML validation always remain active.
78
+ 15. After approval, use `hb-sdk remote release <version>` for manual release or `--auto-publish` when an eligible low-risk version should release automatically.
79
+ 16. Treat approval, release, and public display as separate states. Do not promise square, search, or recommendation visibility after release.
80
+ 17. Use `hb-sdk remote withdraw`, `hb-sdk remote take-down`, `hb-sdk remote reopen`, and square visibility commands only after showing the target and obtaining required confirmation.
81
+ 18. Use `--json` for remote script consumption and `--verbose` only when concise output is insufficient for diagnosis.
82
+ 19. Use `hb-sdk doctor` to diagnose whether the local Skill matches the installed SDK; follow its output to install or refresh the Skill.
83
+ 20. Do not print or expose cookies, tokens, private headers, or other credentials.
83
84
 
84
85
  ## Step 6: Preserve capability boundaries
85
86
 
@@ -301,10 +301,10 @@ Reference 由 `@heybox/hb-sdk` 的公开导出与源码注释自动生成,不
301
301
  | --- | ---: | ---: | ---: | ---: | ---: |
302
302
  | Root API | 2 | 4 | 75 | 73 | 3 |
303
303
  | Protocol API | 0 | 13 | 58 | 90 | 47 |
304
- | Miniapp Publish API | 0 | 5 | 2 | 0 | 0 |
304
+ | Miniapp Publish API | 0 | 7 | 4 | 1 | 2 |
305
305
  | Vite API | 0 | 1 | 5 | 1 | 3 |
306
306
 
307
- <!-- Generated by apps/docs/hb-sdk/scripts/generate-api-docs.ts; schemaVersion=4; fingerprint=7356ab1376630f8bed1028cf9fca72895fc3a1603b8742280c265c53fdeff423 -->
307
+ <!-- Generated by apps/docs/hb-sdk/scripts/generate-api-docs.ts; schemaVersion=4; fingerprint=67370783f01088c3ba37e6506e18d075924b7966e0b53aa3ce82b38bac1a33f3 -->
308
308
 
309
309
  ## SDK API
310
310
 
@@ -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.14`
30
+ - Version at generation time: `0.8.1-alpha.16`
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`
@@ -328,6 +328,8 @@ hb-sdk build [--env <name>] [--verbose]
328
328
 
329
329
  `hb-sdk build` 直接使用项目安装的 Vite,先清理再生成固定的 `dist/`,并校验小程序入口、Manifest 和可上传产物。它不执行类型检查,不要求 CLI 登录或绑定小程序,也不访问远端服务。项目必须在 `package.json#heybox.platforms` 声明目标平台,并在 `vite.config.ts` 中显式注册无参的 `miniappManifest()`;配置与构建产物不一致时构建失败。
330
330
 
331
+ `hb-sdk remote info` 会只读展示 `package.json#heybox.bindAppIds`、当前线上绑定以及新增/移除差异。修改绑定必须更新项目配置并重新提交版本;CLI、Open 和 COA 都不提供第二个写入入口。普通 deploy 在上传文件前把实际构建 Manifest 交给服务端预检;`--from-version` 只使用源版本快照。
332
+
331
333
  直接运行 `hb-sdk build` 或 `vite build` 时默认注入平台 CSP。`hb-sdk remote deploy` 会在构建前读取绑定小程序的远端批准结果,并与当前版本声明取交集;仅当有效 `network` 权限启用时才跳过平台 CSP,`useOfficialDomain` 不参与该判定。权限缺失、非法或读取失败时继续注入,Runtime Gate、Manifest 与 HTML 构建检查始终保留。
332
334
 
333
335
  推荐由项目的 `scripts.build` 保留类型检查:
@@ -172,6 +172,8 @@ hb-sdk build [--env <name>] [--verbose]
172
172
 
173
173
  `hb-sdk build` 直接使用项目安装的 Vite,先清理再生成固定的 `dist/`,并校验小程序入口、Manifest 和可上传产物。它不执行类型检查,不要求 CLI 登录或绑定小程序,也不访问远端服务。项目必须在 `package.json#heybox.platforms` 声明目标平台,并在 `vite.config.ts` 中显式注册无参的 `miniappManifest()`;配置与构建产物不一致时构建失败。
174
174
 
175
+ `hb-sdk remote info` 会只读展示 `package.json#heybox.bindAppIds`、当前线上绑定以及新增/移除差异。修改绑定必须更新项目配置并重新提交版本;CLI、Open 和 COA 都不提供第二个写入入口。普通 deploy 在上传文件前把实际构建 Manifest 交给服务端预检;`--from-version` 只使用源版本快照。
176
+
175
177
  直接运行 `hb-sdk build` 或 `vite build` 时默认注入平台 CSP。`hb-sdk remote deploy` 会在构建前读取绑定小程序的远端批准结果,并与当前版本声明取交集;仅当有效 `network` 权限启用时才跳过平台 CSP,`useOfficialDomain` 不参与该判定。权限缺失、非法或读取失败时继续注入,Runtime Gate、Manifest 与 HTML 构建检查始终保留。
176
178
 
177
179
  推荐由项目的 `scripts.build` 保留类型检查:
package/skill/skill.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "hb-sdk",
3
- "skillVersion": "0.8.1-alpha.14+skill.63b05480eba4",
3
+ "skillVersion": "0.8.1-alpha.16+skill.40a9aaafe9bf",
4
4
  "sdk": {
5
5
  "package": "@heybox/hb-sdk",
6
- "version": "0.8.1-alpha.14",
7
- "compatibility": "0.8.1-alpha.14"
6
+ "version": "0.8.1-alpha.16",
7
+ "compatibility": "0.8.1-alpha.16"
8
8
  },
9
9
  "distribution": {
10
10
  "type": "npm",
11
11
  "package": "@heybox/hb-sdk",
12
- "version": "0.8.1-alpha.14",
12
+ "version": "0.8.1-alpha.16",
13
13
  "path": "skill"
14
14
  },
15
- "integrity": "sha256-63b05480eba4af0e9aeb126196230250ec8349fa1d84e84ebac8005fabe3a602"
15
+ "integrity": "sha256-40a9aaafe9bf39ee033c27c149c7bcfff2f5e7c9674796d1b1ac24f7df9ea81c"
16
16
  }
@@ -0,0 +1,5 @@
1
+ export declare const MINIAPP_BIND_APP_IDS_MAX_COUNT = 20;
2
+ export interface ParseMiniappBindAppIdsOptions {
3
+ sourceLabel?: string;
4
+ }
5
+ export declare function parseMiniappBindAppIds(value: unknown, options?: ParseMiniappBindAppIdsOptions): readonly string[];