@heybox/hb-sdk 0.9.6-alpha.10 → 0.9.6-alpha.13

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 (46) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +8 -1
  3. package/dist/cli-chunks/{artifact-BaZzEQjq.cjs → artifact-CUNeWo4O.cjs} +6 -5
  4. package/dist/cli-chunks/{build-Ykhw1sz9.cjs → build-BnUonzjX.cjs} +6 -5
  5. package/dist/cli-chunks/{create-BEjKsD1y.cjs → create-BbpSkT6L.cjs} +322 -4
  6. package/dist/cli-chunks/{dev-DpkBN4ir.cjs → dev-Bj4ll4KS.cjs} +16 -15
  7. package/dist/cli-chunks/{dev-context-B3Y_EcXC.cjs → dev-context-zGJh3bl_.cjs} +22 -14
  8. package/dist/cli-chunks/{doctor-DPELjB83.cjs → doctor-CJm6yLwg.cjs} +1 -1
  9. package/dist/cli-chunks/{games-D2hnnWKY.cjs → games-M21dEyxU.cjs} +1 -1
  10. package/dist/cli-chunks/{index-DIgSsTuu.cjs → index-C29Bsipw.cjs} +73 -20
  11. package/dist/cli-chunks/{index-DCj9vtVv.cjs → index-DOEadJGe.cjs} +1 -1
  12. package/dist/cli-chunks/{index.esm-t29GC7yg.cjs → index.esm-BDnn3rPW.cjs} +7 -6
  13. package/dist/cli-chunks/index.esm-CvMA_ppV.cjs +7977 -0
  14. package/dist/cli-chunks/{login-C5XmcbRa.cjs → login-sznH9Tub.cjs} +1 -1
  15. package/dist/cli-chunks/{project-vite-B12EMgRq.cjs → project-vite-C3XGMxuI.cjs} +1 -1
  16. package/dist/cli-chunks/{remote-lFAA88Zl.cjs → remote-ZN1aTL2_.cjs} +13 -8
  17. package/dist/cli-chunks/{runtime-permission-env-CYbLBtWo.cjs → runtime-permission-env-CubbhSAi.cjs} +52 -6990
  18. package/dist/cli-chunks/{skill-AilHsggi.cjs → skill-MQLZiQHF.cjs} +2 -2
  19. package/dist/cli-chunks/{version-KZTUyIiC.cjs → version-d8xCNdNj.cjs} +1 -1
  20. package/dist/cli.cjs +1 -1
  21. package/dist/devtools/browser-dev-host/assets/browser-dev-host-OjGtNPTW.js +228 -0
  22. package/dist/devtools/browser-dev-host/assets/desktop-app-launch-Dmzm0ERX.js +6 -0
  23. package/dist/devtools/browser-dev-host/assets/index-BkmmmW8K.css +1 -0
  24. package/dist/devtools/browser-dev-host/assets/index-Dp6vGvaS.js +586 -0
  25. package/dist/devtools/browser-dev-host/index.html +3 -3
  26. package/dist/index.cjs.js +1201 -156
  27. package/dist/index.esm.js +1201 -156
  28. package/dist/miniapp-publish.cjs.js +1072 -131
  29. package/dist/miniapp-publish.esm.js +1072 -131
  30. package/dist/protocol.cjs.js +732 -158
  31. package/dist/protocol.esm.js +716 -159
  32. package/dist/templates/vanilla-vite-js/README.md.ejs +27 -0
  33. package/dist/templates/vanilla-vite-js/package.json.ejs +1 -1
  34. package/dist/templates/vanilla-vite-js/src/user-game-data.js.ejs +1 -0
  35. package/dist/vite.cjs.js +1074 -133
  36. package/dist/vite.esm.js +1074 -133
  37. package/package.json +6 -6
  38. package/skill/SKILL.md +4 -0
  39. package/skill/skill.json +5 -5
  40. package/types/index.d.ts +439 -9
  41. package/types/miniapp-publish/index.d.ts +18 -2
  42. package/types/protocol.d.ts +1 -1
  43. package/dist/devtools/browser-dev-host/assets/browser-dev-host-C0_lx52X.js +0 -100
  44. package/dist/devtools/browser-dev-host/assets/desktop-app-launch-CPk4dD63.js +0 -6
  45. package/dist/devtools/browser-dev-host/assets/index-BzOC7Q8l.js +0 -586
  46. package/dist/devtools/browser-dev-host/assets/index-CHYEXFEg.css +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heybox/hb-sdk",
3
- "version": "0.9.6-alpha.10",
3
+ "version": "0.9.6-alpha.13",
4
4
  "sideEffects": [
5
5
  "./src/index.ts",
6
6
  "./src/core/singleton.ts",
@@ -88,7 +88,7 @@
88
88
  "undici": "^7.28.0",
89
89
  "ws": "^8.18.0",
90
90
  "sharp": "^0.34.5",
91
- "@heybox/hb-sdk-protocol": "0.9.6-alpha.10"
91
+ "@heybox/hb-sdk-protocol": "0.9.6-alpha.13"
92
92
  },
93
93
  "peerDependencies": {
94
94
  "vite": ">=5"
@@ -142,11 +142,11 @@
142
142
  "rollup-plugin-dts": "6.4.0",
143
143
  "playwright-core": "1.64.1",
144
144
  "@heybox-domain/heybox-theme": "~0.1.0",
145
- "@heybox/hb-sdk-runtime": "~0.9.6-alpha.10",
146
- "@heybox/hb-api": "~1.28.22",
147
- "@heybox/runtime-policy": "~0.2.1",
148
- "@heybox/runtime": "~0.2.1",
145
+ "@heybox/hb-api": "~1.28.23",
146
+ "@heybox/hb-sdk-runtime": "~0.9.6-alpha.13",
149
147
  "@heybox-domain/heybox-vue3-ui": "~0.1.0",
148
+ "@heybox/runtime": "~0.2.1",
149
+ "@heybox/runtime-policy": "~0.2.1",
150
150
  "@heybox/runtime-transport-fetch": "~0.2.1"
151
151
  },
152
152
  "publishConfig": {
package/skill/SKILL.md CHANGED
@@ -27,6 +27,10 @@ Before upgrading, verify both the page layout and the captured image. Do not onl
27
27
 
28
28
  接入游戏存档前,通过 canonical 文档索引读取游戏存档指南与方法 Reference,核对当前支持游戏和参数签名。查询结构化数据时区分已有结果读取与同步、解析;按游戏的数据结构检查多槽位、默认槽位和大整数字符串,不假定所有游戏返回同一套字段。同步被近期已有存档限制时,按文档中的业务错误码使用已有存档,不循环触发同步。
29
29
 
30
+ ## 平台/游戏资料与数据许可接入检查
31
+
32
+ 接入平台或游戏资料前,通过 canonical 文档索引读取游戏与平台资料指南、用户数据权限说明和权限声明,核对当前开放的精确资源清单与支持的公开游戏标识。向开发者说明:声明只圈定可读范围,每项资源仍需用户在本设备逐项许可;缺少登录、许可或来源时 SDK 返回可点击操作,页面应展示该操作,不伪造空数据或自动弹窗。存档文件与解析结果是两项独立资源;不要把同步成功当作解析已更新,也不跨来源复用分页游标。用户侧的三种选择、设备范围、拒绝/撤销/重置和介绍页管理入口按用户数据权限说明解释,不把本地许可描述成开发者服务端授权。
33
+
30
34
  ## Canonical Documentation
31
35
 
32
36
  The only maintained hb-sdk guidance source is:
package/skill/skill.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "hb-sdk",
3
- "skillVersion": "0.9.6-alpha.10+skill.fe3b525ecac8",
3
+ "skillVersion": "0.9.6-alpha.13+skill.544e9897249c",
4
4
  "sdk": {
5
5
  "package": "@heybox/hb-sdk",
6
- "version": "0.9.6-alpha.10",
7
- "compatibility": "0.9.6-alpha.10"
6
+ "version": "0.9.6-alpha.13",
7
+ "compatibility": "0.9.6-alpha.13"
8
8
  },
9
9
  "distribution": {
10
10
  "type": "npm",
11
11
  "package": "@heybox/hb-sdk",
12
- "version": "0.9.6-alpha.10",
12
+ "version": "0.9.6-alpha.13",
13
13
  "path": "skill"
14
14
  },
15
- "integrity": "sha256-fe3b525ecac8431e1774ee453864cf9ba58ff6897272e2356ceb17b621c8c427"
15
+ "integrity": "sha256-544e9897249c517ffc25b58cd6739c37032e405eb5df75c785f8e68aeb2fe63d"
16
16
  }
package/types/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { MiniProgramEventName, MiniProgramEventPayloadMap, MiniProgramBridgeError, MiniProgramRuntimeMode, MiniProgramOperatingSystemName, LoginScope as LoginScope$1, AccountState, MiniProgramUserInfoResult, RequestFollowAuthorResult, GetFollowStatusResult, SetDisplayPayload, SetDisplayResult, WorkspaceCardsRefreshOptions, WorkspaceCardLaunchContext, GameSaveFileInfo as GameSaveFileInfo$1, GameSaveInfo as GameSaveInfo$1, GameSaveStructuredData, CompanionExit, CompanionNotificationCategory, CompanionPrepareProgress, CompanionTarget, CompanionCapability, CompanionInfo, CompanionPreparationStatus, ExecuteProtocolInput } from '@heybox/hb-sdk-protocol';
2
- export { AccountState, AuthorFollowStatus, AuthorizedUserInfo, CompanionCapability, CompanionExit, CompanionInfo, CompanionNotificationCategory, CompanionPreparationStatus, CompanionPrepareProgress, CompanionTarget, ExecuteProtocolInput, ExecuteProtocolObject, ExecuteProtocolResult, GameSaveStructuredData, GetFollowStatusResult, MiniProgramDisplayState, MiniProgramEventName, MiniProgramEventPayloadMap, MiniProgramOperatingSystemName, MiniProgramOrientationMode, MiniProgramRuntimeMode, MiniProgramUserInfoResult, RequestFollowAuthorResult, SetDisplayPayload, SetDisplayResult, USER_INFO_AUTHORIZATION_SCOPES, UserInfoAuthorization, UserInfoAuthorizationScope, UserInfoAuthorizationStatus, WorkspaceCardLaunchContext, WorkspaceCardsRefreshOptions } from '@heybox/hb-sdk-protocol';
1
+ import * as _heybox_hb_sdk_protocol from '@heybox/hb-sdk-protocol';
2
+ import { MiniProgramEventName, MiniProgramEventPayloadMap, MiniProgramBridgeError, MiniProgramRuntimeMode, MiniProgramOperatingSystemName, LoginScope as LoginScope$1, AccountState, MiniProgramUserInfoResult, ReadResult, ArkProfile, ArkGachaAnalysis, Page, GachaRecord, UserGameDataGameId, GameOverview, UserGameDataSavesOptions, UserGameDataSaveInfo, UserGameDataSaveFileInfo, SyncResult, BlackMythWukongSave, TaskBarHeroSave, PhantomBladeZeroSave, UserGameDataResourceKey, UserGameDataCancellationSignal, UserDataPermissionRequestResult, DataPermissionSnapshot, RequestFollowAuthorResult, GetFollowStatusResult, SetDisplayPayload, SetDisplayResult, WorkspaceCardsRefreshOptions, WorkspaceCardLaunchContext, GameSaveFileInfo as GameSaveFileInfo$1, GameSaveInfo as GameSaveInfo$1, GameSaveStructuredData, CompanionExit, CompanionNotificationCategory, CompanionPrepareProgress, CompanionTarget, CompanionCapability, CompanionInfo, CompanionPreparationStatus, ExecuteProtocolInput } from '@heybox/hb-sdk-protocol';
3
+ export { AccountState, ArkGachaAnalysis, ArkProfile, AuthorFollowStatus, AuthorizedUserInfo, BlackMythWukongSave, CompanionCapability, CompanionExit, CompanionInfo, CompanionNotificationCategory, CompanionPreparationStatus, CompanionPrepareProgress, CompanionTarget, ExecuteProtocolInput, ExecuteProtocolObject, ExecuteProtocolResult, GachaRecord, GameOverview, GameSaveStructuredData, GetFollowStatusResult, MiniProgramDisplayState, MiniProgramEventName, MiniProgramEventPayloadMap, MiniProgramOperatingSystemName, MiniProgramOrientationMode, MiniProgramRuntimeMode, MiniProgramUserInfoResult, Page, PhantomBladeZeroSave, ReadMeta, ReadResult, RequestFollowAuthorResult, RequiredAction, RequiredActionDescriptor, ResourceOverview, SetDisplayPayload, SetDisplayResult, SyncResult, TaskBarHeroSave, USER_INFO_AUTHORIZATION_SCOPES, UserGameDataGameId, UserGameDataResourceKey, UserGameDataSaveFileInfo, UserGameDataSaveInfo, UserGameDataSavesOptions, UserInfoAuthorization, UserInfoAuthorizationScope, UserInfoAuthorizationStatus, WorkspaceCardLaunchContext, WorkspaceCardsRefreshOptions } from '@heybox/hb-sdk-protocol';
3
4
 
4
5
  /**
5
6
  * 小程序生命周期或业务事件监听函数。
@@ -2778,8 +2779,367 @@ type GetSteamGameListResult = {
2778
2779
  data: SteamGameListData;
2779
2780
  };
2780
2781
 
2782
+ /**
2783
+ * `user.games.getOverview()` 的选项。
2784
+ *
2785
+ * @remarks
2786
+ * `game` 只缩小返回范围,不改变数组形状;省略时由 Host 按当前声明与平台资格返回全部有效游戏。
2787
+ * 显式过滤未开放游戏返回能力错误;已开放但无声明资源返回空数组。
2788
+ *
2789
+ * @since 0.9.6
2790
+ */
2791
+ interface UserGamesOverviewOptions {
2792
+ /** 只返回该游戏的概览;省略表示不限游戏。 */
2793
+ game?: UserGameDataGameId;
2794
+ }
2795
+ /**
2796
+ * 单游戏资料读取的选项。
2797
+ *
2798
+ * @remarks
2799
+ * 使用当前账号的主绑定来源,不接受页面指定的来源引用。
2800
+ *
2801
+ * @since 0.9.6
2802
+ */
2803
+ interface UserGamesProfileOptions {
2804
+ signal?: _heybox_hb_sdk_protocol.UserGameDataCancellationSignal;
2805
+ }
2806
+ /**
2807
+ * 明日方舟抽卡记录分页选项。
2808
+ *
2809
+ * @remarks
2810
+ * `cursor` 不透明且绑定小程序、用户、资源、来源代次与原始查询;换源、过期或跨主体复用必须由
2811
+ * Host 返回标准参数/上下文错误,页面应从首页重新读取。`limit` 是单页数量上限,Host 仍可返回更
2812
+ * 小页。
2813
+ *
2814
+ * @since 0.9.6
2815
+ */
2816
+ interface UserGamesGachaRecordsOptions extends UserGamesProfileOptions {
2817
+ /** 不透明分页 cursor;来自上一页的 `nextCursor`。 */
2818
+ cursor?: string;
2819
+ /** 单页数量上限。 */
2820
+ limit?: number;
2821
+ }
2822
+ /**
2823
+ * 存档文件下载选项。
2824
+ *
2825
+ * @remarks
2826
+ * 下载目标已绑定查询时的游戏、存档与文件,方法不接受 URL、路径或文件 ID,因此不能改写目标;
2827
+ * 取消只结束本地等待。
2828
+ *
2829
+ * @since 0.9.6
2830
+ */
2831
+ interface UserGameSaveFileOptions {
2832
+ /** 取消信号。 */
2833
+ signal?: AbortSignal;
2834
+ }
2835
+ /**
2836
+ * 云存档文件元数据,并在 SDK 层附加受控的 `downloadFile()`。
2837
+ *
2838
+ * @remarks
2839
+ * 对应契约类型 `GameSaveFileInfo`;wire 类型为 `UserGameDataSaveFileInfo`(不含函数)。对象只持有
2840
+ * 受控 Host 引用与元数据,不暴露可独立复用的私有下载 URL 或路径。重启、切号、换源或撤销后,
2841
+ * 旧对象不能继续交付新字节。下载前缺许可返回 `PERMISSION_DENIED`,句柄许可失效返回
2842
+ * `FILE_ACCESS_REVOKED`;来源未关联、登录过期与许可存储故障使用各自稳定错误码。
2843
+ *
2844
+ * @since 0.9.6
2845
+ * @hbPlatform android
2846
+ * @hbPlatform ios
2847
+ * @hbPlatform ohos
2848
+ * @hbPlatform windows
2849
+ * @hbPlatform macos
2850
+ * @hbClient android none
2851
+ * @hbClient ios none
2852
+ * @hbClient ohos none
2853
+ * @hbClient windows none
2854
+ * @hbClient macos none
2855
+ */
2856
+ interface UserGameSaveFileInfo extends UserGameDataSaveFileInfo {
2857
+ /**
2858
+ * 下载当前文件并返回只读文件句柄。
2859
+ *
2860
+ * @param options - 取消信号。
2861
+ * @returns 受控只读文件句柄;字节经 Host 检查后交付,已交付字节无法追回。
2862
+ * @throws {@link HbMiniProgramSDKError} `DOWNLOAD_CANCELLED` 表示调用方取消等待;`INVALID_RESPONSE`
2863
+ * 表示 Host 返回了非只读、带 URL/路径或其它不合法的文件描述符;`PERMISSION_DENIED` 表示当前
2864
+ * 尚未取得 `save_files` 许可或用户已拒绝。`USER_DATA_SOURCE_NOT_LINKED` / `USER_DATA_SOURCE_LOGIN_REQUIRED`
2865
+ * 表示来源未关联 / 需要重新登录;已交付句柄的许可失效返回 `FILE_ACCESS_REVOKED`。
2866
+ * 许可存储不可用或损坏分别返回 `USER_DATA_PERMISSION_STORAGE_UNAVAILABLE` / `USER_DATA_PERMISSION_STATE_INVALID`。
2867
+ * @remarks
2868
+ * 文件对象沿用列表中的游戏、存档与文件引用取得受控描述符,
2869
+ * 不接受 URL、路径或任意文件 ID。许可不足时不会向来源取数,需先通过 `list()` 完成授权。
2870
+ */
2871
+ downloadFile(options?: UserGameSaveFileOptions): Promise<FileHandle>;
2872
+ }
2873
+ /**
2874
+ * 一个云存档批次,并在 SDK 层携带可下载文件对象。
2875
+ *
2876
+ * @remarks
2877
+ * 对应契约类型 `GameSaveInfo`;wire 类型为 `UserGameDataSaveInfo`。
2878
+ *
2879
+ * @since 0.9.6
2880
+ * @hbPlatform android
2881
+ * @hbPlatform ios
2882
+ * @hbPlatform ohos
2883
+ * @hbPlatform windows
2884
+ * @hbPlatform macos
2885
+ * @hbClient android none
2886
+ * @hbClient ios none
2887
+ * @hbClient ohos none
2888
+ * @hbClient windows none
2889
+ * @hbClient macos none
2890
+ */
2891
+ interface UserGameSaveInfo extends Omit<UserGameDataSaveInfo, 'files'> {
2892
+ /** 该批次的文件元数据与受控下载方法。 */
2893
+ files: UserGameSaveFileInfo[];
2894
+ }
2895
+ /**
2896
+ * 云存档三方法合同。
2897
+ *
2898
+ * @typeParam T - 该游戏已发布的解析结果类型,由 SDK 按公开 GameId 固定;开发者不填泛型,也不存在
2899
+ * 「原始 JSON 兜底」的泛型出口。
2900
+ *
2901
+ * @remarks
2902
+ * - `list` 不触发同步或解析;无文件为 `ready` 空数组。
2903
+ * - `sync` 是游戏级同步,将原存档上传至小黑盒;文件交付仍需 `save_files` 许可。
2904
+ * - `sync` 等待文件同步终态,成功不保证解析已更新;终态失败抛标准错误。
2905
+ * - `getLatestStructuredData` 只读已有规范化结果,不启动新同步或解析。
2906
+ *
2907
+ * @since 0.9.6
2908
+ * @hbPlatform android
2909
+ * @hbPlatform ios
2910
+ * @hbPlatform ohos
2911
+ * @hbPlatform windows
2912
+ * @hbPlatform macos
2913
+ * @hbClient android none
2914
+ * @hbClient ios none
2915
+ * @hbClient ohos none
2916
+ * @hbClient windows none
2917
+ * @hbClient macos none
2918
+ */
2919
+ interface UserGameSavesModule<T> {
2920
+ /** 查询云存档文件清单;不需要先同步,没有文件时为 `ready` 空数组。 */
2921
+ list(options?: UserGameDataSavesOptions): Promise<ReadResult<UserGameSaveInfo[]>>;
2922
+ /** 创建或加入同步任务并等待终态;成功只保证文件已同步。 */
2923
+ sync(options?: UserGameDataSavesOptions): Promise<SyncResult>;
2924
+ /** 读取最新已有的规范化解析结果;没有数据或未就绪分别表达。 */
2925
+ getLatestStructuredData(options?: UserGameDataSavesOptions): Promise<ReadResult<T>>;
2926
+ }
2927
+ /**
2928
+ * 明日方舟资料模块(`game.ark.profile` 与 `game.ark.gacha`)。
2929
+ *
2930
+ * @remarks
2931
+ * 明日方舟不提供 `saves`;三款存档游戏不提供这里的方法,静态类型层面就不存在。
2932
+ *
2933
+ * @since 0.9.6
2934
+ * @hbPlatform android
2935
+ * @hbPlatform ios
2936
+ * @hbPlatform ohos
2937
+ * @hbPlatform windows
2938
+ * @hbPlatform macos
2939
+ * @hbClient android none
2940
+ * @hbClient ios none
2941
+ * @hbClient ohos none
2942
+ * @hbClient windows none
2943
+ * @hbClient macos none
2944
+ */
2945
+ interface ArkGameModule {
2946
+ /** 读取当前用户方舟角色/养成资料(`game.ark.profile`)。
2947
+ * @since 0.9.6
2948
+ */
2949
+ getProfile(options?: UserGamesProfileOptions): Promise<ReadResult<ArkProfile>>;
2950
+ /** 读取当前用户方舟抽卡分析(`game.ark.gacha`)。
2951
+ * @since 0.9.6
2952
+ */
2953
+ getGachaAnalysis(options?: UserGamesProfileOptions): Promise<ReadResult<ArkGachaAnalysis>>;
2954
+ /** 分页读取当前用户方舟抽卡记录;cursor 不透明且绑定原查询。
2955
+ * @since 0.9.6
2956
+ */
2957
+ listGachaRecords(options?: UserGamesGachaRecordsOptions): Promise<ReadResult<Page<GachaRecord>>>;
2958
+ }
2959
+ /**
2960
+ * 三款首发存档游戏的模块;`saves` 是唯一资料入口。
2961
+ *
2962
+ * @typeParam T - 该游戏已发布的解析结果类型。
2963
+ *
2964
+ * @since 0.9.6
2965
+ * @hbPlatform android
2966
+ * @hbPlatform ios
2967
+ * @hbPlatform ohos
2968
+ * @hbPlatform windows
2969
+ * @hbPlatform macos
2970
+ * @hbClient android none
2971
+ * @hbClient ios none
2972
+ * @hbClient ohos none
2973
+ * @hbClient windows none
2974
+ * @hbClient macos none
2975
+ */
2976
+ interface UserSaveGameModule<T> {
2977
+ /** 云存档查询、同步与结构化读取。 */
2978
+ readonly saves: UserGameSavesModule<T>;
2979
+ }
2980
+ /** 三款首发存档游戏的公开 GameId。 */
2981
+ interface GameModuleMap {
2982
+ ark: ArkGameModule;
2983
+ black_myth_wukong: UserSaveGameModule<BlackMythWukongSave>;
2984
+ task_bar_hero: UserSaveGameModule<TaskBarHeroSave>;
2985
+ phantom_blade_zero: UserSaveGameModule<PhantomBladeZeroSave>;
2986
+ }
2987
+ type UserGameModule<TGame extends UserGameDataGameId> = GameModuleMap[TGame];
2988
+ /**
2989
+ * 游戏资料入口(`hbSDK.user.games`)。
2990
+ *
2991
+ * @remarks
2992
+ * - `getOverview()` 返回声明范围内的公开资源目录;无有效资源时返回 `ready` 空数组,不触发
2993
+ * 登录、许可或来源查询。
2994
+ * - `get(gameId)` 只取得无状态门面,不取数、不登录、不改变来源;未开放的 GameId 返回能力错误。
2995
+ * - 每次业务调用都会重新解析当前受信用户与许可,旧门面不保留创建时的身份。
2996
+ *
2997
+ */
2998
+ interface UserGamesModule {
2999
+ /** 读取声明范围内已开放资源的游戏资料概览。
3000
+ * @since 0.9.6
3001
+ * @hbPlatform android
3002
+ * @hbPlatform ios
3003
+ * @hbPlatform ohos
3004
+ * @hbPlatform windows
3005
+ * @hbPlatform macos
3006
+ * @hbClient android none
3007
+ * @hbClient ios none
3008
+ * @hbClient ohos none
3009
+ * @hbClient windows none
3010
+ * @hbClient macos none
3011
+ */
3012
+ getOverview(options?: UserGamesOverviewOptions): Promise<ReadResult<GameOverview[]>>;
3013
+ /**
3014
+ * 取得指定游戏的无状态门面。
3015
+ *
3016
+ * @param gameId - 已开放的公开 GameId。
3017
+ * @returns 按 GameId 收窄的模块;`ark` 只有具名方舟方法,三款存档游戏只有 `saves`。
3018
+ * @throws {@link HbMiniProgramSDKError} `REQUEST_UNSUPPORTED` 表示该 GameId 未在首发目录开放;
3019
+ * 参数类型不合法时返回 `INVALID_PARAMS`。
3020
+ * @remarks 取得门面不发送任何请求、不登录、不改变来源,也不授予许可。
3021
+ * @since 0.9.6
3022
+ * @hbPlatform android
3023
+ * @hbPlatform ios
3024
+ * @hbPlatform ohos
3025
+ * @hbPlatform windows
3026
+ * @hbPlatform macos
3027
+ * @hbClient android none
3028
+ * @hbClient ios none
3029
+ * @hbClient ohos none
3030
+ * @hbClient windows none
3031
+ * @hbClient macos none
3032
+ */
3033
+ get<TGame extends UserGameDataGameId>(gameId: TGame): UserGameModule<TGame>;
3034
+ }
3035
+
3036
+ /** 当前设备上的资料许可;决定由可信 Host UI 确认。
3037
+ */
3038
+ interface UserDataPermissionModule {
3039
+ /** 用户点击后请求指定资料许可;范围与用途来自受信声明。
3040
+ * @since 0.9.6
3041
+ * @hbPlatform android
3042
+ * @hbPlatform ios
3043
+ * @hbPlatform ohos
3044
+ * @hbPlatform windows
3045
+ * @hbPlatform macos
3046
+ * @hbClient android none
3047
+ * @hbClient ios none
3048
+ * @hbClient ohos none
3049
+ * @hbClient windows none
3050
+ * @hbClient macos none
3051
+ */
3052
+ request(resource: UserGameDataResourceKey, options?: {
3053
+ signal?: UserGameDataCancellationSignal;
3054
+ }): Promise<UserDataPermissionRequestResult>;
3055
+ /** 查询本机许可,不读取个人游戏资料。
3056
+ * @since 0.9.6
3057
+ * @hbPlatform android
3058
+ * @hbPlatform ios
3059
+ * @hbPlatform ohos
3060
+ * @hbPlatform windows
3061
+ * @hbPlatform macos
3062
+ * @hbClient android none
3063
+ * @hbClient ios none
3064
+ * @hbClient ohos none
3065
+ * @hbClient windows none
3066
+ * @hbClient macos none
3067
+ */
3068
+ get(): Promise<DataPermissionSnapshot>;
3069
+ /** 撤销本次许可;需要用户点击。
3070
+ * @since 0.9.6
3071
+ * @hbPlatform android
3072
+ * @hbPlatform ios
3073
+ * @hbPlatform ohos
3074
+ * @hbPlatform windows
3075
+ * @hbPlatform macos
3076
+ * @hbClient android none
3077
+ * @hbClient ios none
3078
+ * @hbClient ohos none
3079
+ * @hbClient windows none
3080
+ * @hbClient macos none
3081
+ */
3082
+ revokeSession(resource?: UserGameDataResourceKey): Promise<DataPermissionSnapshot>;
3083
+ /** 打开可信 Host 数据许可管理界面;需要用户点击。
3084
+ * @since 0.9.6
3085
+ * @hbPlatform android
3086
+ * @hbPlatform ios
3087
+ * @hbPlatform ohos
3088
+ * @hbPlatform windows
3089
+ * @hbPlatform macos
3090
+ * @hbClient android none
3091
+ * @hbClient ios none
3092
+ * @hbClient ohos none
3093
+ * @hbClient windows none
3094
+ * @hbClient macos none
3095
+ */
3096
+ openSettings(): Promise<DataPermissionSnapshot>;
3097
+ }
3098
+
2781
3099
  /** 外部小程序可调用的用户模块。 */
2782
3100
  interface MiniProgramUserModule {
3101
+ /** 本机游戏资料许可管理。
3102
+ */
3103
+ readonly dataPermission: UserDataPermissionModule;
3104
+ /**
3105
+ * 游戏资料入口:统一概览与按公开 GameId 收窄的具名模块。
3106
+ *
3107
+ * @remarks
3108
+ * 首版开放明日方舟角色/抽卡资料,以及黑神话悟空、任务栏英雄、影之刃零三款云存档解析与文件资源。
3109
+ * 模块存在只表示平台支持,不表示用户已关联、已许可或已有数据;`get(gameId)` 不发送请求、不登录、
3110
+ * 不改变来源,未开放 GameId 返回 `REQUEST_UNSUPPORTED`。每次业务调用都会重新解析当前受信用户与
3111
+ * 许可,旧门面不保留创建时的身份。
3112
+ *
3113
+ * 读取结果使用统一 `ReadResult`:`ready` 只交付通过公开 schema 的数据,列表无项目是 `ready` 空
3114
+ * 集合,单份结果不存在或解析未就绪使用 `empty`;缺少用户许可、登录或来源时返回带 `resolve()`
3115
+ * 的 `RequiredAction`,由用户在点击后推进,SDK 不会自动弹窗。
3116
+ *
3117
+ * @example
3118
+ * ```ts
3119
+ * import hbSDK from '@heybox/hb-sdk'
3120
+ *
3121
+ * const dashboard = await hbSDK.user.games.getOverview()
3122
+ * if (dashboard.status === 'ready') renderGames(dashboard.data)
3123
+ *
3124
+ * const profile = await hbSDK.user.games.get('ark').getProfile()
3125
+ * if (profile.status === 'ready') renderProfile(profile.data)
3126
+ * else if (profile.status === 'blocked' && profile.action) showActionButton(profile.action)
3127
+ * ```
3128
+ *
3129
+ * @see [权限声明](/guide/permissions) 声明 `user_game_data` 资源清单。
3130
+ *
3131
+ * @hbPlatform android
3132
+ * @hbPlatform ios
3133
+ * @hbPlatform ohos
3134
+ * @hbPlatform windows
3135
+ * @hbPlatform macos
3136
+ * @hbClient android none
3137
+ * @hbClient ios none
3138
+ * @hbClient ohos none
3139
+ * @hbClient windows none
3140
+ * @hbClient macos none
3141
+ */
3142
+ readonly games: UserGamesModule;
2783
3143
  /**
2784
3144
  * 引导关注当前小程序作者;必须在点击事件中直接调用。
2785
3145
  *
@@ -3393,6 +3753,15 @@ interface MiniProgramScreenshotOptions {
3393
3753
  */
3394
3754
  post?: MiniProgramSharePostOptions | null;
3395
3755
  }
3756
+ /**
3757
+ * DOM 区域截图配置;除用必填的 `element` 替代 `rect` 外,其余配置与原截图接口一致。
3758
+ *
3759
+ * @see {@link MiniProgramShareModule.screenshotElement | share.screenshotElement}
3760
+ */
3761
+ interface MiniProgramScreenshotElementOptions extends Omit<MiniProgramScreenshotOptions, 'rect'> {
3762
+ /** 当前页面中已挂载、有布局尺寸的 DOM 元素;长内容由支持的移动宿主自动生成长图。 */
3763
+ element: Element;
3764
+ }
3396
3765
 
3397
3766
  /** `share.copyLink` 入参;省略后生成不带 `extra` 的通用分享链接。 */
3398
3767
  type CopyLinkPayload = MiniProgramCopyLinkOptions | undefined;
@@ -3729,6 +4098,50 @@ interface MiniProgramShareModule {
3729
4098
  * @hbClient macos none
3730
4099
  */
3731
4100
  screenshot(options?: MiniProgramScreenshotOptions): Promise<ScreenshotResult>;
4101
+ /**
4102
+ * 按 DOM 元素所在的矩形区域截图并唤起分享。
4103
+ *
4104
+ * @param options - 必填配置;用 `element` 替代原截图接口的 `rect`,其余选项保持一致。
4105
+ * @returns 与 {@link MiniProgramShareModule.screenshot | share.screenshot} 相同的不透明结果。
4106
+ * @throws {@link HbMiniProgramSDKError} 配置无效、传入 `rect`、元素不属于当前页面、未挂载、
4107
+ * 无可见布局尺寸、普通截图边界超出窗口或长图尺寸超限时返回 `INVALID_PARAMS`;其余错误由原截图流程透传。
4108
+ *
4109
+ * @remarks
4110
+ * 截图串行执行,轮到本次请求时读取 `element.getBoundingClientRect()`,使用当前窗口逻辑像素,不需要手动
4111
+ * 加滚动偏移或乘设备像素比。DOM 不会通过 bridge 传输;权限、平台支持、延迟、水印、
4112
+ * 相册入口与社区预置均沿用 {@link MiniProgramShareModule.screenshot | share.screenshot}。
4113
+ *
4114
+ * 普通元素仍截取当前窗口矩形;超过窗口高度或具有纵向溢出内容的 HTML 元素自动走原生长图。
4115
+ * 长图需要配套 Runtime 和 iOS / Android Host;旧宿主明确拒绝,不回退为截断图片。仅支持纵向长图,元素超出窗口宽度或自身横向溢出时返回 `INVALID_PARAMS`;长图宽度不得超过窗口,
4116
+ * 高度最多 10000、面积最多 400 万逻辑像素。SDK 临时复制已渲染内容并冻结计算样式,结束后清理。
4117
+ * 嵌入网页、视频、固定/吸顶元素和自定义元素不支持;虚拟列表未渲染的内容不会自动生成,嵌套滚动容器仍保留自身裁剪。
4118
+ * 普通截图的祖先裁剪和遮挡保持实际画面语义。请先完成资源加载,并在操作期间保持内容稳定。
4119
+ * 截图区域底部仍需预留至少 57 个逻辑像素供水印使用。
4120
+ *
4121
+ * @example
4122
+ * ```ts
4123
+ * import hbSDK from '@heybox/hb-sdk'
4124
+ *
4125
+ * const element = document.querySelector('#share-card')
4126
+ * if (element) {
4127
+ * await hbSDK.share.screenshotElement({ element, delay: 100, saveToAlbum: true })
4128
+ * }
4129
+ * ```
4130
+ *
4131
+ * @see {@link MiniProgramScreenshotElementOptions}
4132
+ * @since 0.9.6
4133
+ * @hbPlatform android
4134
+ * @hbPlatform ios
4135
+ * @hbPlatform ohos
4136
+ * @hbPlatform windows
4137
+ * @hbPlatform macos
4138
+ * @hbClient android none
4139
+ * @hbClient ios none
4140
+ * @hbClient ohos none
4141
+ * @hbClient windows none
4142
+ * @hbClient macos none
4143
+ */
4144
+ screenshotElement(options: MiniProgramScreenshotElementOptions): Promise<ScreenshotResult>;
3732
4145
  }
3733
4146
 
3734
4147
  /**
@@ -4065,11 +4478,15 @@ interface WorkspaceCardsModule {
4065
4478
  onLaunchContextChange(listener: (context: WorkspaceCardLaunchContext | null) => void): () => void;
4066
4479
  }
4067
4480
 
4068
- /** 文件对象已绑定查询时的游戏、账号、存档和文件,只需指定取消信号。 */
4481
+ /** 文件对象已绑定查询时的游戏、账号、存档和文件,只需指定取消信号。
4482
+ * @deprecated Since 0.9.6-alpha.12. 请改用 {@link UserGamesModule.get},使用返回对象的 saves 能力;此入口将在 0.10.0 移除。
4483
+ */
4069
4484
  interface GameSavesFileOptions {
4070
4485
  signal?: AbortSignal;
4071
4486
  }
4072
- /** list 返回的存档文件;元数据不会触发下载,调用 downloadFile 后才下载。 */
4487
+ /** list 返回的存档文件;元数据不会触发下载,调用 downloadFile 后才下载。
4488
+ * @deprecated Since 0.9.6-alpha.12. 请改用 {@link UserGamesModule.get},使用返回对象的 saves 能力;此入口将在 0.10.0 移除。
4489
+ */
4073
4490
  interface GameSaveFileInfo extends Readonly<GameSaveFileInfo$1> {
4074
4491
  /**
4075
4492
  * 下载并返回只读 ZIP 文件,可通过 readBytes() 交给开发者解压和解析。
@@ -4078,19 +4495,27 @@ interface GameSaveFileInfo extends Readonly<GameSaveFileInfo$1> {
4078
4495
  */
4079
4496
  downloadFile(options?: GameSavesFileOptions): Promise<FileHandle>;
4080
4497
  }
4498
+ /**
4499
+ * @deprecated Since 0.9.6-alpha.12. 请改用 {@link UserGamesModule.get},使用返回对象的 saves 能力;此入口将在 0.10.0 移除。
4500
+ */
4081
4501
  interface GameSaveInfo extends Omit<GameSaveInfo$1, 'files'> {
4082
4502
  files: GameSaveFileInfo[];
4083
4503
  }
4084
- /** 同步由 Runtime 等待至终态;取消仅停止等待,不撤销已经创建的服务端任务。 */
4504
+ /** 同步由 Runtime 等待至终态;取消仅停止等待,不撤销已经创建的服务端任务。
4505
+ * @deprecated Since 0.9.6-alpha.12. 请改用 {@link UserGamesModule.get},使用返回对象的 saves 能力;此入口将在 0.10.0 移除。
4506
+ */
4085
4507
  interface GameSavesSyncOptions {
4086
4508
  signal?: AbortSignal;
4087
4509
  }
4088
- /** 游戏存档;需声明 gameSaves,无需单独弹窗确认,服务端校验当前账号及存档归属。 */
4510
+ /** 游戏存档;需声明 gameSaves,无需单独弹窗确认,服务端校验当前账号及存档归属。
4511
+ * @deprecated Since 0.9.6-alpha.12. 请改用 {@link UserGamesModule.get},使用返回对象的 saves 能力;此入口将在 0.10.0 移除。
4512
+ */
4089
4513
  interface GameSavesModule {
4090
4514
  /** 查询指定 Steam 游戏的新版云同步存档;没有存档时返回空数组。
4091
4515
  * @remarks
4092
4516
  * 需要配套 H5/Runtime 和后端;复用已有客户端账号及网络能力,不新增客户端版本门槛。
4093
4517
  * 运行环境缺少所需能力时会拒绝调用;文件下载另需宿主支持文件与传输能力。
4518
+ * @deprecated Since 0.9.6-alpha.12. 请改用 {@link UserGamesModule.get},使用返回对象的 saves 能力;此入口将在 0.10.0 移除。
4094
4519
  * @since 0.9.4
4095
4520
  * @hbPlatform android
4096
4521
  * @hbPlatform ios
@@ -4106,6 +4531,7 @@ interface GameSavesModule {
4106
4531
  list(gameId: string): Promise<GameSaveInfo[]>;
4107
4532
  /** 读取当前 Steam 账号最新已有的完整结构化业务数据,不对应某个存档批次或 ZIP。
4108
4533
  * @remarks 读取已保存的数据,不触发更新;无需先查询或同步文件。
4534
+ * @deprecated Since 0.9.6-alpha.12. 请改用 {@link UserGamesModule.get},使用返回对象的 saves 能力;此入口将在 0.10.0 移除。
4109
4535
  * @since 0.9.4
4110
4536
  * @hbPlatform android
4111
4537
  * @hbPlatform ios
@@ -4123,6 +4549,7 @@ interface GameSavesModule {
4123
4549
  * @remarks
4124
4550
  * 需要配套 H5/Runtime 和后端;复用已有客户端账号及网络能力,不新增客户端版本门槛。
4125
4551
  * 运行环境缺少所需能力时会拒绝调用;文件下载另需宿主支持文件与传输能力。
4552
+ * @deprecated Since 0.9.6-alpha.12. 请改用 {@link UserGamesModule.get},使用返回对象的 saves 能力;此入口将在 0.10.0 移除。
4126
4553
  * @since 0.9.4
4127
4554
  * @hbPlatform android
4128
4555
  * @hbPlatform ios
@@ -7993,9 +8420,12 @@ declare const ui: MiniProgramUiModule;
7993
8420
  declare const device: MiniProgramDeviceModule;
7994
8421
  /** 默认 SDK 实例的 navigation 模块。 */
7995
8422
  declare const navigation: MiniProgramNavigationModule;
7996
- /** 默认 SDK 实例的 cloud 模块。 */
7997
- /** 当前用户的游戏存档能力。 */
8423
+ /**
8424
+ * 当前用户的游戏存档能力。
8425
+ * @deprecated Since 0.9.6-alpha.12. 请改用 {@link UserGamesModule.get},使用返回对象的 saves 能力;此入口将在 0.10.0 移除。
8426
+ */
7998
8427
  declare const gameSaves: GameSavesModule;
8428
+ /** 默认 SDK 实例的 cloud 模块。 */
7999
8429
  declare const cloud: MiniProgramCloudModule;
8000
8430
  /** 默认 SDK 实例的受管桌面程序模块。 */
8001
8431
  declare const companion: MiniProgramCompanionModule;
@@ -8028,4 +8458,4 @@ declare const hbSDK: {
8028
8458
  };
8029
8459
 
8030
8460
  export { HbMiniProgramNetworkError, HbMiniProgramSDKError, auth, cloud, companion, hbSDK as default, device, environment, files, gameSaves, getHandshakeState, media, navigation, network, off, on, onHandshakeStateChange, share, storage, ui, user, viewport, workspaceCards };
8031
- export type { ClosePayload, CloseResult, CompanionAttachments, CompanionExitHandler, CompanionNotification, CompanionNotifications, CompanionOutputHandler, CompanionOwnershipLostHandler, CompanionPrepareOptions, CompanionSession, CompanionState, CompanionStateChangeHandler, CompanionStdio, CopyLinkPayload, CopyLinkResult, CreateOptions, DeleteCurrentUserLeaderboardEntryPayload, DeleteCurrentUserLeaderboardEntryResult, DirectoryHandle, DownloadBaseOptions, DownloadOptions, DownloadProgress, FileHandle, FileMode, FileStat, FileSystem, FileSystemEntity, FilesModule, GameSaveFileInfo, GameSaveInfo, GameSavesFileOptions, GameSavesModule, GameSavesSyncOptions, GetCurrentUserLeaderboardEntryPayload, GetCurrentUserLeaderboardEntryResult, GetLeaderboardInfoPayload, GetLeaderboardInfoResult, GetLeaderboardListPayload, GetLeaderboardListResult, GetSteamGameListOptions, GetSteamGameListPayload, GetSteamGameListResult, GetStoragePayload, GetStorageResult, GetUserInfoPayload, GetUserInfoResult, GetWindowInfoPayload, GetWindowInfoResult, HideLoadingPayload, HideLoadingResult, LeaderboardEntry, LeaderboardOrder, ListOptions, LoginOptions, LoginPayload, LoginResult, LoginScope, MediaImageItem, MediaItem, MediaModule, MediaSelectionType, MediaType, MediaVideoItem, MiniProgramAppPageTarget, MiniProgramAuthModule, MiniProgramCloudLeaderboardModule, MiniProgramCloudModule, MiniProgramCloudStorageModule, MiniProgramCompanionModule, MiniProgramCopyLinkOptions, MiniProgramDeviceModule, MiniProgramEnvironmentInfo, MiniProgramEnvironmentModule, MiniProgramEventHandler, MiniProgramGameDetailGameType, MiniProgramGameDetailPage, MiniProgramNavigationBarForegroundStyle, MiniProgramNavigationModule, MiniProgramNetworkHeaders, MiniProgramNetworkModule, MiniProgramNetworkParams, MiniProgramNetworkRequestConfig, MiniProgramNetworkRequestMethod, MiniProgramNetworkResponse, MiniProgramNetworkValidateStatus, MiniProgramSDKHandshakeState, MiniProgramSDKHandshakeStateHandler, MiniProgramSafeArea, MiniProgramScreenshotOptions, MiniProgramScreenshotRect, MiniProgramSetNavigationBarStyleOptions, MiniProgramShareChannel, MiniProgramShareExtraValue, MiniProgramShareModule, MiniProgramSharePostOptions, MiniProgramShowShareMenuOptions, MiniProgramStorageModule, MiniProgramToastStatus, MiniProgramUiModule, MiniProgramUserModule, MiniProgramVibrateIntensity, MiniProgramViewportModule, MiniProgramWindowInfoResult, NetworkRequestPayload, NetworkResponsePayload, OpenAppPageOptions, OpenAppPagePayload, OpenAppPageResult, OpenGameDetailAppPageOptions, OpenGameDetailAppPagePayload, OpenMiniProgramAppPageOptions, OpenMiniProgramAppPagePayload, OpenPostDetailAppPageOptions, OpenPostDetailAppPagePayload, OpenUserDetailAppPageOptions, OpenUserDetailAppPagePayload, PathRoot, PickDirectoryOptions, PickFilesOptions, PickMediaOptions, ReloadPayload, ReloadResult, RemoveOptions, RevokeAuthorizationPayload, RevokeAuthorizationResult, SaveFileOptions, ScreenshotPayload, ScreenshotResult, SetClipboardPayload, SetClipboardResult, SetNavigationBarStylePayload, SetNavigationBarStyleResult, SetStoragePayload, ShowLoadingPayload, ShowLoadingResult, ShowShareMenuPayload, ShowShareMenuResult, ShowToastPayload, ShowToastResult, SteamGameListData, SteamGameListItem, SteamGameListSort, SubmitLeaderboardEntryPayload, SubmitLeaderboardEntryResult, UploadBaseOptions, UploadOptions, UploadProgress, UploadResponse, VibratePayload, VibrateResult, WorkspaceCardsModule };
8461
+ export type { ArkGameModule, ClosePayload, CloseResult, CompanionAttachments, CompanionExitHandler, CompanionNotification, CompanionNotifications, CompanionOutputHandler, CompanionOwnershipLostHandler, CompanionPrepareOptions, CompanionSession, CompanionState, CompanionStateChangeHandler, CompanionStdio, CopyLinkPayload, CopyLinkResult, CreateOptions, DeleteCurrentUserLeaderboardEntryPayload, DeleteCurrentUserLeaderboardEntryResult, DirectoryHandle, DownloadBaseOptions, DownloadOptions, DownloadProgress, FileHandle, FileMode, FileStat, FileSystem, FileSystemEntity, FilesModule, GameSaveFileInfo, GameSaveInfo, GameSavesFileOptions, GameSavesModule, GameSavesSyncOptions, GetCurrentUserLeaderboardEntryPayload, GetCurrentUserLeaderboardEntryResult, GetLeaderboardInfoPayload, GetLeaderboardInfoResult, GetLeaderboardListPayload, GetLeaderboardListResult, GetSteamGameListOptions, GetSteamGameListPayload, GetSteamGameListResult, GetStoragePayload, GetStorageResult, GetUserInfoPayload, GetUserInfoResult, GetWindowInfoPayload, GetWindowInfoResult, HideLoadingPayload, HideLoadingResult, LeaderboardEntry, LeaderboardOrder, ListOptions, LoginOptions, LoginPayload, LoginResult, LoginScope, MediaImageItem, MediaItem, MediaModule, MediaSelectionType, MediaType, MediaVideoItem, MiniProgramAppPageTarget, MiniProgramAuthModule, MiniProgramCloudLeaderboardModule, MiniProgramCloudModule, MiniProgramCloudStorageModule, MiniProgramCompanionModule, MiniProgramCopyLinkOptions, MiniProgramDeviceModule, MiniProgramEnvironmentInfo, MiniProgramEnvironmentModule, MiniProgramEventHandler, MiniProgramGameDetailGameType, MiniProgramGameDetailPage, MiniProgramNavigationBarForegroundStyle, MiniProgramNavigationModule, MiniProgramNetworkHeaders, MiniProgramNetworkModule, MiniProgramNetworkParams, MiniProgramNetworkRequestConfig, MiniProgramNetworkRequestMethod, MiniProgramNetworkResponse, MiniProgramNetworkValidateStatus, MiniProgramSDKHandshakeState, MiniProgramSDKHandshakeStateHandler, MiniProgramSafeArea, MiniProgramScreenshotElementOptions, MiniProgramScreenshotOptions, MiniProgramScreenshotRect, MiniProgramSetNavigationBarStyleOptions, MiniProgramShareChannel, MiniProgramShareExtraValue, MiniProgramShareModule, MiniProgramSharePostOptions, MiniProgramShowShareMenuOptions, MiniProgramStorageModule, MiniProgramToastStatus, MiniProgramUiModule, MiniProgramUserModule, MiniProgramVibrateIntensity, MiniProgramViewportModule, MiniProgramWindowInfoResult, NetworkRequestPayload, NetworkResponsePayload, OpenAppPageOptions, OpenAppPagePayload, OpenAppPageResult, OpenGameDetailAppPageOptions, OpenGameDetailAppPagePayload, OpenMiniProgramAppPageOptions, OpenMiniProgramAppPagePayload, OpenPostDetailAppPageOptions, OpenPostDetailAppPagePayload, OpenUserDetailAppPageOptions, OpenUserDetailAppPagePayload, PathRoot, PickDirectoryOptions, PickFilesOptions, PickMediaOptions, ReloadPayload, ReloadResult, RemoveOptions, RevokeAuthorizationPayload, RevokeAuthorizationResult, SaveFileOptions, ScreenshotPayload, ScreenshotResult, SetClipboardPayload, SetClipboardResult, SetNavigationBarStylePayload, SetNavigationBarStyleResult, SetStoragePayload, ShowLoadingPayload, ShowLoadingResult, ShowShareMenuPayload, ShowShareMenuResult, ShowToastPayload, ShowToastResult, SteamGameListData, SteamGameListItem, SteamGameListSort, SubmitLeaderboardEntryPayload, SubmitLeaderboardEntryResult, UploadBaseOptions, UploadOptions, UploadProgress, UploadResponse, UserDataPermissionModule, UserGameSaveFileInfo, UserGameSaveFileOptions, UserGameSaveInfo, UserGameSavesModule, UserGamesGachaRecordsOptions, UserGamesModule, UserGamesOverviewOptions, UserGamesProfileOptions, UserSaveGameModule, VibratePayload, VibrateResult, WorkspaceCardsModule };
@@ -1,4 +1,4 @@
1
- import { MiniProgramPermissionKey, WorkspaceCardsManifest } from '@heybox/hb-sdk-protocol';
1
+ import { MiniProgramPermissionKey, UserGameDataResourceDeclarations, WorkspaceCardsManifest } from '@heybox/hb-sdk-protocol';
2
2
 
3
3
  /** 小程序发布类别:`tool` 为工具、`game` 为游戏、`other` 为其他;新上传版本必须声明,历史读取可缺省。 */
4
4
  type MiniappCategory = 'tool' | 'game' | 'other';
@@ -24,6 +24,19 @@ interface NetworkMiniappPermissionDeclaration extends SimpleMiniappPermissionDec
24
24
  /** 是否申请官方域名访问,项目省略时规范化为 false;实际启用还需远端批准该配置。 */
25
25
  useOfficialDomain: boolean;
26
26
  }
27
+ /**
28
+ * 构建产物中的平台/游戏资料声明,附带精确资源清单。
29
+ *
30
+ * @remarks
31
+ * `resources` 必须显式提供资源对象,每项填写用途并由用户在本设备逐项许可。
32
+ * 空对象 `{}` 表示不请求任何资源;本地调试与发布快照沿用同一形状。
33
+ *
34
+ * @since 0.9.6
35
+ */
36
+ interface UserGameDataMiniappPermissionDeclaration extends SimpleMiniappPermissionDeclaration {
37
+ /** 以精确资源 key 为键的用途对象;不接受通配符、前缀或未开放资源。 */
38
+ resources: UserGameDataResourceDeclarations;
39
+ }
27
40
  /**
28
41
  * 构建规范化后写入 Manifest 的权限对象;仅包含请求启用的权限,空对象表示无权限需求。
29
42
  *
@@ -31,9 +44,11 @@ interface NetworkMiniappPermissionDeclaration extends SimpleMiniappPermissionDec
31
44
  * 这是本地声明,不是运行时授权结果。仅需声明的权限按声明生效;要求平台批准的权限还需与远端批准
32
45
  * 求交,network 的 useOfficialDomain 配置也需同时获批。显式声明中缺失某权限表示不请求该权限;
33
46
  * SDK 0.9 系列起项目必须提供该对象,0.8 历史产物未声明时另按迁移规则处理。
47
+ * `user_game_data.resources` 会随声明进入本地调试上下文与发布 Manifest。
34
48
  */
35
- type MiniappPermissionDeclarations = Partial<Record<Exclude<MiniappPermissionKey, 'network'>, SimpleMiniappPermissionDeclaration> & {
49
+ type MiniappPermissionDeclarations = Partial<Record<Exclude<MiniappPermissionKey, 'network' | 'user_game_data'>, SimpleMiniappPermissionDeclaration> & {
36
50
  network: NetworkMiniappPermissionDeclaration;
51
+ user_game_data: UserGameDataMiniappPermissionDeclaration;
37
52
  }>;
38
53
 
39
54
  declare const MINIAPP_COMPANION_TARGETS: readonly ["windows-x64", "macos-arm64"];
@@ -224,6 +239,7 @@ declare function validateMiniappManifestForDeploy(manifest: MiniappManifest): {
224
239
  companions?: MiniappCompanionManifestDeclarations | undefined;
225
240
  permissions?: Partial<Record<"storage" | "workspaceCards" | "userInfo" | "steamLibrary" | "share" | "cloud_storage" | "gameSaves" | "filesystem" | "media" | "clipboard" | "leaderboard" | "companion" | "appProtocol", SimpleMiniappPermissionDeclaration> & {
226
241
  network: NetworkMiniappPermissionDeclaration;
242
+ user_game_data: UserGameDataMiniappPermissionDeclaration;
227
243
  }> | undefined;
228
244
  platforms: readonly ("windows" | "macos" | "android" | "ios" | "ohos" | "linux")[];
229
245
  name?: string | undefined;