@heybox/hb-sdk 0.7.5-alpha.0 → 0.8.0-alpha.10

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 (111) hide show
  1. package/CHANGELOG.md +99 -352
  2. package/README.md +103 -26
  3. package/THIRD_PARTY_NOTICES.md +1755 -0
  4. package/dist/cli-chunks/{build-V1YBdpzY.cjs → build-aDJbiFqF.cjs} +9 -5
  5. package/dist/cli-chunks/{context-Ba1Je-wT.cjs → context-Dp36pZ9a.cjs} +39 -81
  6. package/dist/cli-chunks/{create-CKGjqo9E.cjs → create-P3g0ricz.cjs} +2 -2
  7. package/dist/cli-chunks/{dev-XopYKLYZ.cjs → dev-CisJkXuQ.cjs} +396 -576
  8. package/dist/cli-chunks/doctor-B-LF5-uj.cjs +65 -0
  9. package/dist/cli-chunks/{index-C9mpajVG.cjs → index-BDaeBI_B.cjs} +50 -30
  10. package/dist/cli-chunks/{index-DKWfX6Ut.cjs → index-CZGkk7fQ.cjs} +2 -2
  11. package/dist/cli-chunks/{index.esm-SXAQ3WVR.cjs → index.esm-NNLG29Tt.cjs} +8 -7
  12. package/dist/cli-chunks/{login-BVWicWqe.cjs → login-DTY5GolC.cjs} +2 -2
  13. package/dist/cli-chunks/{project-vite-CBb38HJ3.cjs → project-vite-DlCjHlu_.cjs} +1 -1
  14. package/dist/cli-chunks/{remote-BG1u0NKT.cjs → remote-BBMr7j8W.cjs} +61 -27
  15. package/dist/cli-chunks/{runtime-gate-CtV7rWyX.cjs → runtime-gate-BppCl1r3.cjs} +30 -3
  16. package/dist/cli-chunks/{runtime-permission-env-D-8_jPG3.cjs → runtime-permission-env-CqsTHeas.cjs} +364 -13
  17. package/dist/cli-chunks/{session-CJS_SEp9.cjs → session-CnGeZCRZ.cjs} +1 -1
  18. package/dist/cli-chunks/skill-B0yAnPOJ.cjs +83 -0
  19. package/dist/cli-chunks/version-DN5jrixS.cjs +8 -0
  20. package/dist/cli.cjs +1 -1
  21. package/dist/devtools/browser-dev-host/assets/browser-dev-host-BhZGUyYw.js +97 -0
  22. package/dist/devtools/browser-dev-host/assets/heybox-logo-CogNENsk.svg +6 -0
  23. package/dist/devtools/browser-dev-host/assets/index-DJFB5ySU.css +1 -0
  24. package/dist/devtools/browser-dev-host/assets/index-Dh9H1JOm.js +567 -0
  25. package/dist/devtools/browser-dev-host/assets/workbench-state-wHgWRb7I.js +5 -0
  26. package/dist/devtools/browser-dev-host/index.html +6 -435
  27. package/dist/index.cjs.js +1051 -91
  28. package/dist/index.esm.js +1051 -92
  29. package/dist/miniapp-publish.cjs.js +13 -13
  30. package/dist/miniapp-publish.esm.js +13 -13
  31. package/dist/protocol.cjs.js +381 -37
  32. package/dist/protocol.esm.js +355 -38
  33. package/dist/templates/{vue3-vite-ts → vanilla-vite-js}/.gitignore.ejs +0 -1
  34. package/dist/templates/vanilla-vite-js/README.md.ejs +14 -0
  35. package/dist/templates/vanilla-vite-js/index.html.ejs +20 -0
  36. package/dist/templates/vanilla-vite-js/package.json.ejs +22 -0
  37. package/dist/templates/vanilla-vite-js/src/assets/heybox-logo.svg +8 -0
  38. package/dist/templates/vanilla-vite-js/src/main.js +39 -0
  39. package/dist/templates/vanilla-vite-js/src/styles.css +155 -0
  40. package/dist/templates/{vue3-vite-ts/vite.config.ts → vanilla-vite-js/vite.config.js} +1 -2
  41. package/dist/vite.cjs.js +256 -10
  42. package/dist/vite.esm.js +256 -11
  43. package/package.json +37 -11
  44. package/skill/SKILL.md +22 -20
  45. package/skill/references/api-protocol.md +112 -6
  46. package/skill/references/api-root.md +194 -30
  47. package/skill/references/cli.md +41 -24
  48. package/skill/references/examples.md +31 -2
  49. package/skill/references/llms-index.md +1 -1
  50. package/skill/references/recipes.md +139 -36
  51. package/skill/references/safety-boundaries.md +15 -6
  52. package/skill/skill.json +10 -5
  53. package/types/core/client.d.ts +17 -1
  54. package/types/core/errors.d.ts +5 -5
  55. package/types/core/sdk.d.ts +8 -5
  56. package/types/core/singleton.d.ts +59 -6
  57. package/types/index.d.ts +4 -2
  58. package/types/miniapp-manifest/index.d.ts +1 -0
  59. package/types/miniapp-manifest/node.d.ts +3 -0
  60. package/types/miniapp-manifest/permissions.d.ts +37 -0
  61. package/types/miniapp-manifest/schema.d.ts +10 -0
  62. package/types/miniapp-publish/index.d.ts +8 -8
  63. package/types/modules/auth/index.d.ts +15 -1
  64. package/types/modules/cloud/index.d.ts +75 -5
  65. package/types/modules/device/index.d.ts +31 -3
  66. package/types/modules/files/index.d.ts +5 -0
  67. package/types/modules/files/registry.d.ts +35 -0
  68. package/types/modules/files/types.d.ts +159 -0
  69. package/types/modules/navigation/index.d.ts +46 -4
  70. package/types/modules/network/index.d.ts +72 -14
  71. package/types/modules/share/copy-link.d.ts +3 -3
  72. package/types/modules/share/index.d.ts +61 -5
  73. package/types/modules/share/screenshot.d.ts +3 -3
  74. package/types/modules/share/show-share-menu.d.ts +4 -4
  75. package/types/modules/share/types.d.ts +2 -4
  76. package/types/modules/storage/index.d.ts +38 -10
  77. package/types/modules/ui/index.d.ts +46 -4
  78. package/types/modules/user/get-info.d.ts +1 -1
  79. package/types/modules/user/index.d.ts +46 -4
  80. package/types/modules/user/steam-game-list.d.ts +2 -2
  81. package/types/modules/viewport/index.d.ts +36 -8
  82. package/types/protocol/capabilities.d.ts +2 -2
  83. package/types/protocol/constants.d.ts +1 -1
  84. package/types/protocol/guards.d.ts +1 -1
  85. package/types/protocol/types.d.ts +1 -1
  86. package/types/protocol.d.ts +4 -3
  87. package/types/skill-metadata.d.ts +0 -4
  88. package/types/vite/index.d.ts +15 -7
  89. package/dist/cli-chunks/doctor-BHbrYQqT.cjs +0 -204
  90. package/dist/devtools/browser-dev-host/main.js +0 -12158
  91. package/dist/templates/vue3-vite-ts/README.md.ejs +0 -45
  92. package/dist/templates/vue3-vite-ts/index.html.ejs +0 -12
  93. package/dist/templates/vue3-vite-ts/package.json.ejs +0 -33
  94. package/dist/templates/vue3-vite-ts/src/App.vue +0 -78
  95. package/dist/templates/vue3-vite-ts/src/__tests__/App.spec.ts +0 -148
  96. package/dist/templates/vue3-vite-ts/src/auth-handoff.ts +0 -46
  97. package/dist/templates/vue3-vite-ts/src/main.ts +0 -5
  98. package/dist/templates/vue3-vite-ts/src/styles.css +0 -60
  99. package/dist/templates/vue3-vite-ts/src/vite-env.d.ts +0 -1
  100. package/dist/templates/vue3-vite-ts/tsconfig.app.json +0 -17
  101. package/dist/templates/vue3-vite-ts/tsconfig.json +0 -11
  102. package/dist/templates/vue3-vite-ts/tsconfig.node.json +0 -11
  103. package/dist/templates/vue3-vite-ts/vitest.config.ts +0 -10
  104. package/skill/scripts/check-references.mjs +0 -14
  105. package/skill/scripts/markdown-sections.mjs +0 -36
  106. package/skill/scripts/package-skill.mjs +0 -60
  107. package/skill/scripts/package-skill.sh +0 -6
  108. package/skill/scripts/skill-metadata.mjs +0 -77
  109. package/skill/scripts/sync-agent-skills-payload.mjs +0 -359
  110. package/skill/scripts/sync-references.mjs +0 -792
  111. package/skill/scripts/validate-skill.mjs +0 -263
@@ -8,12 +8,54 @@ export * from './steam-game-list';
8
8
  export * from './types';
9
9
  /** 外部小程序可调用的用户模块。 */
10
10
  export interface MiniProgramUserModule {
11
- /** 获取当前黑盒 APP 登录态、授权状态和已获准披露的资料。 */
11
+ /**
12
+ * 获取当前黑盒 APP 登录态、授权状态和已获准披露的资料。
13
+ *
14
+ * @since 0.2.0-alpha.0
15
+ * @hbPlatform android
16
+ * @hbPlatform ios
17
+ * @hbPlatform ohos
18
+ * @hbPlatform windows
19
+ * @hbPlatform macos
20
+ * @hbClient android none
21
+ * @hbClient ios none
22
+ * @hbClient ohos none
23
+ * @hbClient windows none
24
+ * @hbClient macos none
25
+ */
12
26
  getInfo(): Promise<GetUserInfoResult>;
13
- /** 撤销当前用户授予本小程序的授权;必须由可信用户操作触发。 */
27
+ /**
28
+ * 撤销当前用户授予本小程序的授权;必须由可信用户操作触发。
29
+ *
30
+ * @since 0.7.0-alpha.1
31
+ * @hbPlatform android
32
+ * @hbPlatform ios
33
+ * @hbPlatform ohos
34
+ * @hbPlatform windows
35
+ * @hbPlatform macos
36
+ * @hbClient android none
37
+ * @hbClient ios none
38
+ * @hbClient ohos none
39
+ * @hbClient windows none
40
+ * @hbClient macos none
41
+ */
14
42
  revokeAuthorization(): Promise<RevokeAuthorizationResult>;
15
- /** 获取当前用户的 Steam 游戏库。 */
43
+ /**
44
+ * 获取当前用户的 Steam 游戏库。
45
+ *
46
+ * @since 0.5.0
47
+ * @hbPlatform android
48
+ * @hbPlatform ios
49
+ * @hbPlatform ohos
50
+ * @hbPlatform windows
51
+ * @hbPlatform macos
52
+ * @hbClient android none
53
+ * @hbClient ios none
54
+ * @hbClient ohos none
55
+ * @hbClient windows none
56
+ * @hbClient macos none
57
+ */
16
58
  getSteamGameList(options?: GetSteamGameListOptions): Promise<GetSteamGameListResult>;
17
59
  }
18
60
  export declare function createUserModule(requester: MiniProgramRequester): MiniProgramUserModule;
19
- export { USER_GET_INFO_METHOD, USER_GET_STEAM_GAME_LIST_METHOD, USER_REVOKE_AUTHORIZATION_METHOD, };
61
+ export { USER_GET_INFO_METHOD, USER_GET_STEAM_GAME_LIST_METHOD, USER_REVOKE_AUTHORIZATION_METHOD };
@@ -64,8 +64,8 @@ export type GetSteamGameListResult = {
64
64
  /**
65
65
  * 获取当前用户 Steam 游戏库。
66
66
  *
67
- * @param requester 底层 bridge 请求能力。
68
- * @param options 查询与分页参数。
67
+ * @param requester - 底层 bridge 请求能力。
68
+ * @param options - 查询与分页参数。
69
69
  * @returns 当前用户 Steam 游戏库;未登录或未绑定 Steam 时返回状态对象。
70
70
  */
71
71
  export declare function getSteamGameList(requester: MiniProgramRequester, options?: GetSteamGameListOptions): Promise<GetSteamGameListResult>;
@@ -73,32 +73,60 @@ export type SetNavigationBarStyleResult = void;
73
73
  export type { MiniProgramViewportMethod } from '../../protocol/capabilities';
74
74
  /** 外部小程序可调用的 Viewport 模块。 */
75
75
  export interface MiniProgramViewportModule {
76
- /** 获取当前小程序窗口信息。 */
76
+ /**
77
+ * 获取当前小程序窗口信息。
78
+ *
79
+ * @since 0.2.0-alpha.0
80
+ * @hbPlatform android
81
+ * @hbPlatform ios
82
+ * @hbPlatform ohos
83
+ * @hbPlatform windows
84
+ * @hbPlatform macos
85
+ * @hbClient android none
86
+ * @hbClient ios none
87
+ * @hbClient ohos none
88
+ * @hbClient windows none
89
+ * @hbClient macos none
90
+ */
77
91
  getWindowInfo(): Promise<GetWindowInfoResult>;
78
- /** 设置导航栏关闭按钮与状态栏图标/文字的前景样式。 */
92
+ /**
93
+ * 设置导航栏关闭按钮与状态栏图标/文字的前景样式。
94
+ *
95
+ * @since 0.4.0
96
+ * @hbPlatform android
97
+ * @hbPlatform ios
98
+ * @hbPlatform ohos
99
+ * @hbPlatform windows
100
+ * @hbPlatform macos
101
+ * @hbClient android none
102
+ * @hbClient ios none
103
+ * @hbClient ohos none
104
+ * @hbClient windows none
105
+ * @hbClient macos none
106
+ */
79
107
  setNavigationBarStyle(options: MiniProgramSetNavigationBarStyleOptions): Promise<SetNavigationBarStyleResult>;
80
108
  }
81
109
  /**
82
110
  * 获取当前小程序窗口信息。
83
111
  *
84
- * @param requester 底层 bridge 请求能力。
112
+ * @param requester - 底层 bridge 请求能力。
85
113
  * @returns 当前小程序可用窗口信息。
86
- * @throws {HbMiniProgramSDKError} 当 bridge、父容器或宿主能力调用失败时抛出。
114
+ * @throws {@link HbMiniProgramSDKError} 当 bridge、父容器或宿主能力调用失败时抛出。
87
115
  */
88
116
  export declare function getWindowInfo(requester: MiniProgramRequester): Promise<GetWindowInfoResult>;
89
117
  /**
90
118
  * 设置导航栏关闭按钮与状态栏图标/文字的前景样式。
91
119
  *
92
- * @param requester 底层 bridge 请求能力。
93
- * @param options 导航栏样式配置。
120
+ * @param requester - 底层 bridge 请求能力。
121
+ * @param options - 导航栏样式配置。
94
122
  * @returns 宿主接受设置后 resolve。
95
- * @throws {HbMiniProgramSDKError} 当 bridge、父容器或宿主能力调用失败时抛出。
123
+ * @throws {@link HbMiniProgramSDKError} 当 bridge、父容器或宿主能力调用失败时抛出。
96
124
  */
97
125
  export declare function setNavigationBarStyle(requester: MiniProgramRequester, options: MiniProgramSetNavigationBarStyleOptions): Promise<SetNavigationBarStyleResult>;
98
126
  /**
99
127
  * 创建 Viewport 模块。
100
128
  *
101
- * @param requester 底层 bridge 请求能力。
129
+ * @param requester - 底层 bridge 请求能力。
102
130
  * @returns 面向业务层的 Viewport 模块对象。
103
131
  */
104
132
  export declare function createViewportModule(requester: MiniProgramRequester): MiniProgramViewportModule;
@@ -1,2 +1,2 @@
1
- export { AUTH_LOGIN_METHOD, CLOUD_LEADERBOARD_DELETE_CURRENT_USER_ENTRY_METHOD, CLOUD_LEADERBOARD_GET_CURRENT_USER_ENTRY_METHOD, CLOUD_LEADERBOARD_GET_INFO_METHOD, CLOUD_LEADERBOARD_GET_LIST_METHOD, CLOUD_LEADERBOARD_SUBMIT_METHOD, DEVICE_SET_CLIPBOARD_METHOD, DEVICE_VIBRATE_METHOD, MINI_PROGRAM_PROTOCOL_CAPABILITIES, NAVIGATION_CLOSE_METHOD, NAVIGATION_OPEN_APP_PAGE_METHOD, NAVIGATION_RELOAD_METHOD, NETWORK_REQUEST_METHOD, SHARE_COPY_LINK_METHOD, SHARE_SCREENSHOT_METHOD, SHARE_SHOW_SHARE_MENU_METHOD, STORAGE_GET_STORAGE_METHOD, STORAGE_SET_STORAGE_METHOD, UI_HIDE_LOADING_METHOD, UI_SHOW_LOADING_METHOD, UI_SHOW_TOAST_METHOD, USER_GET_INFO_METHOD, USER_GET_STEAM_GAME_LIST_METHOD, USER_REVOKE_AUTHORIZATION_METHOD, VIEWPORT_GET_WINDOW_INFO_METHOD, VIEWPORT_SET_NAVIGATION_BAR_STYLE_METHOD, } from '@heybox/hb-sdk-protocol';
2
- export type { MiniProgramAuthMethod, MiniProgramBridgeMethod, MiniProgramCapabilityDefinition, MiniProgramCapabilityModule, MiniProgramCapabilityPayload, MiniProgramCapabilityPayloadMap, MiniProgramCapabilityResult, MiniProgramCapabilityResultMap, MiniProgramCapabilityRisk, MiniProgramCloudMethod, MiniProgramDeviceMethod, MiniProgramNavigationMethod, MiniProgramNetworkMethod, MiniProgramShareMethod, MiniProgramStorageMethod, MiniProgramUiMethod, MiniProgramUserMethod, MiniProgramViewportMethod, } from '@heybox/hb-sdk-protocol';
1
+ export { AUTH_LOGIN_METHOD, CLOUD_LEADERBOARD_DELETE_CURRENT_USER_ENTRY_METHOD, CLOUD_LEADERBOARD_GET_CURRENT_USER_ENTRY_METHOD, CLOUD_LEADERBOARD_GET_INFO_METHOD, CLOUD_LEADERBOARD_GET_LIST_METHOD, CLOUD_LEADERBOARD_SUBMIT_METHOD, DIRECTORY_CREATE_METHOD, DIRECTORY_EXISTS_METHOD, DIRECTORY_LIST_METHOD, DIRECTORY_REMOVE_METHOD, DEVICE_SET_CLIPBOARD_METHOD, DEVICE_VIBRATE_METHOD, FILES_PICK_DIRECTORY_METHOD, FILES_PICK_FILES_METHOD, FILES_SAVE_FILE_METHOD, FILE_CREATE_METHOD, FILE_EXISTS_METHOD, FILE_READ_BYTES_METHOD, FILE_READ_TEXT_METHOD, FILE_REMOVE_METHOD, FILE_STAT_METHOD, FILE_WRITE_BYTES_METHOD, FILE_WRITE_TEXT_METHOD, MINI_PROGRAM_PROTOCOL_CAPABILITIES, NAVIGATION_CLOSE_METHOD, NAVIGATION_OPEN_APP_PAGE_METHOD, NAVIGATION_RELOAD_METHOD, NETWORK_REQUEST_METHOD, NETWORK_DOWNLOAD_METHOD, SHARE_COPY_LINK_METHOD, SHARE_SCREENSHOT_METHOD, SHARE_SHOW_SHARE_MENU_METHOD, STORAGE_GET_STORAGE_METHOD, STORAGE_SET_STORAGE_METHOD, UI_HIDE_LOADING_METHOD, UI_SHOW_LOADING_METHOD, UI_SHOW_TOAST_METHOD, USER_GET_INFO_METHOD, USER_GET_STEAM_GAME_LIST_METHOD, USER_REVOKE_AUTHORIZATION_METHOD, VIEWPORT_GET_WINDOW_INFO_METHOD, VIEWPORT_SET_NAVIGATION_BAR_STYLE_METHOD, } from '@heybox/hb-sdk-protocol';
2
+ export type { MiniProgramAuthMethod, MiniProgramBridgeMethod, MiniProgramCapabilityDefinition, MiniProgramCapabilityModule, MiniProgramCapabilityPayload, MiniProgramCapabilityPayloadMap, MiniProgramCapabilityResult, MiniProgramCapabilityResultMap, MiniProgramCapabilityRisk, MiniProgramCloudMethod, MiniProgramDeviceMethod, MiniProgramDirectoryMethod, MiniProgramFileMethod, MiniProgramFilesMethod, MiniProgramNavigationMethod, MiniProgramNetworkMethod, MiniProgramShareMethod, MiniProgramStorageMethod, MiniProgramUiMethod, MiniProgramUserMethod, MiniProgramViewportMethod, } from '@heybox/hb-sdk-protocol';
@@ -1 +1 @@
1
- export { MINI_PROGRAM_BRIDGE_NONCE_PARAM, MINI_PROGRAM_MESSAGE_NAMESPACE, MINI_PROGRAM_MESSAGE_VERSION, RUNTIME_LOCATION_PROBE_METHOD, SDK_CSP_VIOLATION_METHOD, SDK_HANDSHAKE_METHOD, SDK_LOCATION_REPORT_METHOD, } from '@heybox/hb-sdk-protocol';
1
+ export { MINI_PROGRAM_BRIDGE_NONCE_PARAM, MINI_PROGRAM_MESSAGE_NAMESPACE, MINI_PROGRAM_MESSAGE_VERSION, MINI_PROGRAM_OPERATION_PROGRESS_METHOD, RUNTIME_LOCATION_PROBE_METHOD, SDK_CSP_VIOLATION_METHOD, SDK_HANDSHAKE_METHOD, SDK_LOCATION_REPORT_METHOD, } from '@heybox/hb-sdk-protocol';
@@ -1 +1 @@
1
- export { isMiniProgramBridgeMessage } from '@heybox/hb-sdk-protocol';
1
+ export { isMiniProgramBridgeMessage, isMiniProgramByteArray, isMiniProgramDirectoryDescriptor, isMiniProgramDirectoryRef, isMiniProgramDownloadProgressPayload, isMiniProgramFileDescriptor, isMiniProgramFileRef, isMiniProgramFileStat, isMiniProgramFileSystemEntityDescriptor, isMiniProgramPathRootRef, isMiniProgramRelativePath, } from '@heybox/hb-sdk-protocol';
@@ -1,4 +1,4 @@
1
1
  import type { MiniProgramEventName, MiniProgramEventPayloadMap } from '@heybox/hb-sdk-protocol';
2
- export type { MiniProgramBridgeError, MiniProgramBridgeMessage, MiniProgramBridgeMessageType, MiniProgramEventName, MiniProgramEventPayloadMap, RuntimeLocationProbePayload, SDKCSPBlockedResourceType, SDKCSPViolationPayload, SDKHandshakePayload, SDKLocationReportPayload, SDKLocationReportTrigger, } from '@heybox/hb-sdk-protocol';
2
+ export type { MiniProgramBridgeError, MiniProgramBridgeCancelMessage, MiniProgramBridgeMessage, MiniProgramBridgeMessageType, MiniProgramBridgeProgressMessage, MiniProgramEventName, MiniProgramEventPayloadMap, RuntimeLocationProbePayload, SDKCSPBlockedResourceType, SDKCSPViolationPayload, SDKHandshakePayload, SDKLocationReportPayload, SDKLocationReportTrigger, } from '@heybox/hb-sdk-protocol';
3
3
  /** 小程序事件监听函数。 */
4
4
  export type MiniProgramEventHandler<T extends MiniProgramEventName = MiniProgramEventName> = (payload: MiniProgramEventPayloadMap[T]) => void;
@@ -1,8 +1,9 @@
1
- export { AUTH_LOGIN_METHOD, CLOUD_LEADERBOARD_DELETE_CURRENT_USER_ENTRY_METHOD, CLOUD_LEADERBOARD_GET_CURRENT_USER_ENTRY_METHOD, CLOUD_LEADERBOARD_GET_INFO_METHOD, CLOUD_LEADERBOARD_GET_LIST_METHOD, CLOUD_LEADERBOARD_SUBMIT_METHOD, DEVICE_SET_CLIPBOARD_METHOD, DEVICE_VIBRATE_METHOD, MINI_PROGRAM_BRIDGE_NONCE_PARAM, MINI_PROGRAM_MESSAGE_NAMESPACE, MINI_PROGRAM_MESSAGE_VERSION, MINI_PROGRAM_PROTOCOL_CAPABILITIES, NAVIGATION_CLOSE_METHOD, NAVIGATION_OPEN_APP_PAGE_METHOD, NAVIGATION_RELOAD_METHOD, NETWORK_REQUEST_METHOD, RUNTIME_LOCATION_PROBE_METHOD, SDK_CSP_VIOLATION_METHOD, SDK_HANDSHAKE_METHOD, SDK_LOCATION_REPORT_METHOD, SHARE_COPY_LINK_METHOD, SHARE_SCREENSHOT_METHOD, SHARE_SHOW_SHARE_MENU_METHOD, STORAGE_GET_STORAGE_METHOD, STORAGE_SET_STORAGE_METHOD, UI_HIDE_LOADING_METHOD, UI_SHOW_LOADING_METHOD, UI_SHOW_TOAST_METHOD, USER_INFO_AUTHORIZATION_SCOPES, USER_GET_INFO_METHOD, USER_GET_STEAM_GAME_LIST_METHOD, USER_REVOKE_AUTHORIZATION_METHOD, VIEWPORT_GET_WINDOW_INFO_METHOD, VIEWPORT_SET_NAVIGATION_BAR_STYLE_METHOD, isManagedMiniProgramRuntimePermissionKey, isMiniProgramBridgeMessage, parseMiniProgramRuntimePermissions, } from '@heybox/hb-sdk-protocol';
2
- export type { AuthorizedUserInfo, ClosePayload, CloseResult, CopyLinkPayload, CopyLinkResult, DeleteCurrentUserLeaderboardEntryPayload, DeleteCurrentUserLeaderboardEntryResult, GetCurrentUserLeaderboardEntryPayload, GetCurrentUserLeaderboardEntryResult, GetLeaderboardInfoPayload, GetLeaderboardInfoResult, GetLeaderboardListPayload, GetLeaderboardListResult, GetSteamGameListPayload, GetSteamGameListResult, GetStoragePayload, GetStorageResult, GetUserInfoPayload, GetUserInfoResult, GetWindowInfoPayload, GetWindowInfoResult, HideLoadingPayload, HideLoadingResult, LeaderboardEntry, LeaderboardOrder, LoginPayload, LoginResult, LoginScope, MiniProgramAuthMethod, MiniProgramBridgeError, MiniProgramBridgeMessage, MiniProgramBridgeMessageType, MiniProgramBridgeMethod, MiniProgramCapabilityDefinition, MiniProgramCapabilityModule, MiniProgramCapabilityPayload, MiniProgramCapabilityPayloadMap, MiniProgramCapabilityResult, MiniProgramCapabilityResultMap, MiniProgramCapabilityRisk, MiniProgramCloudMethod, MiniProgramDeviceMethod, MiniProgramEventName, MiniProgramEventPayloadMap, MiniProgramNavigationBarForegroundStyle, MiniProgramNavigationMethod, MiniProgramNetworkHeaders, MiniProgramNetworkMethod, MiniProgramNetworkParams, MiniProgramNetworkRequestMethod, MiniProgramRuntimePermissionEntry, MiniProgramRuntimePermissionsSnapshot, MiniProgramRuntimePermissionStatus, MiniProgramSafeArea, MiniProgramScreenshotRect, MiniProgramShareChannel, MiniProgramShareMethod, MiniProgramSharePostOptions, MiniProgramStorageMethod, MiniProgramToastStatus, MiniProgramUiMethod, MiniProgramUserInfoResult, MiniProgramUserMethod, MiniProgramVibrateIntensity, MiniProgramViewportMethod, MiniProgramWindowInfoResult, NetworkRequestPayload, NetworkResponsePayload, OpenAppPagePayload, OpenAppPageResult, OpenGameDetailAppPagePayload, OpenPostDetailAppPagePayload, OpenUserDetailAppPagePayload, ParsedMiniProgramRuntimePermissions, ReloadPayload, ReloadResult, RevokeAuthorizationPayload, RevokeAuthorizationResult, RuntimeLocationProbePayload, ScreenshotPayload, ScreenshotResult, SDKCSPBlockedResourceType, SDKCSPViolationPayload, SDKHandshakePayload, SDKLocationReportPayload, SDKLocationReportTrigger, SetClipboardPayload, SetClipboardResult, SetNavigationBarStylePayload, SetNavigationBarStyleResult, SetStoragePayload, ShowLoadingPayload, ShowLoadingResult, ShowShareMenuPayload, ShowShareMenuResult, ShowToastPayload, ShowToastResult, SteamGameListData, SteamGameListItem, SteamGameListSort, SteamGamePrice, SubmitLeaderboardEntryPayload, SubmitLeaderboardEntryResult, UserInfoAuthorization, UserInfoAuthorizationScope, UserInfoAuthorizationStatus, VibratePayload, VibrateResult, } from '@heybox/hb-sdk-protocol';
1
+ export { AUTH_LOGIN_METHOD, CLOUD_LEADERBOARD_DELETE_CURRENT_USER_ENTRY_METHOD, CLOUD_LEADERBOARD_GET_CURRENT_USER_ENTRY_METHOD, CLOUD_LEADERBOARD_GET_INFO_METHOD, CLOUD_LEADERBOARD_GET_LIST_METHOD, CLOUD_LEADERBOARD_SUBMIT_METHOD, DIRECTORY_CREATE_METHOD, DIRECTORY_EXISTS_METHOD, DIRECTORY_LIST_METHOD, DIRECTORY_REMOVE_METHOD, DEVICE_SET_CLIPBOARD_METHOD, DEVICE_VIBRATE_METHOD, FILES_PICK_DIRECTORY_METHOD, FILES_PICK_FILES_METHOD, FILES_SAVE_FILE_METHOD, FILE_CREATE_METHOD, FILE_EXISTS_METHOD, FILE_READ_BYTES_METHOD, FILE_READ_TEXT_METHOD, FILE_REMOVE_METHOD, FILE_STAT_METHOD, FILE_WRITE_BYTES_METHOD, FILE_WRITE_TEXT_METHOD, MINI_PROGRAM_BRIDGE_NONCE_PARAM, MINI_PROGRAM_MESSAGE_NAMESPACE, MINI_PROGRAM_MESSAGE_VERSION, MINI_PROGRAM_OPERATION_PROGRESS_METHOD, MINI_PROGRAM_PROTOCOL_CAPABILITIES, NAVIGATION_CLOSE_METHOD, NAVIGATION_OPEN_APP_PAGE_METHOD, NAVIGATION_RELOAD_METHOD, NETWORK_REQUEST_METHOD, NETWORK_DOWNLOAD_METHOD, RUNTIME_LOCATION_PROBE_METHOD, SDK_CSP_VIOLATION_METHOD, SDK_HANDSHAKE_METHOD, SDK_LOCATION_REPORT_METHOD, SHARE_COPY_LINK_METHOD, SHARE_SCREENSHOT_METHOD, SHARE_SHOW_SHARE_MENU_METHOD, STORAGE_GET_STORAGE_METHOD, STORAGE_SET_STORAGE_METHOD, UI_HIDE_LOADING_METHOD, UI_SHOW_LOADING_METHOD, UI_SHOW_TOAST_METHOD, USER_INFO_AUTHORIZATION_SCOPES, USER_GET_INFO_METHOD, USER_GET_STEAM_GAME_LIST_METHOD, USER_REVOKE_AUTHORIZATION_METHOD, VIEWPORT_GET_WINDOW_INFO_METHOD, VIEWPORT_SET_NAVIGATION_BAR_STYLE_METHOD, isManagedMiniProgramRuntimePermissionKey, isMiniProgramByteArray, isMiniProgramBridgeMessage, isMiniProgramDirectoryDescriptor, isMiniProgramDirectoryRef, isMiniProgramDownloadProgressPayload, isMiniProgramFileDescriptor, isMiniProgramFileRef, isMiniProgramFileStat, isMiniProgramFileSystemEntityDescriptor, isMiniProgramPathRootRef, isMiniProgramRelativePath, parseMiniProgramRuntimePermissions, } from '@heybox/hb-sdk-protocol';
2
+ export type { AuthorizedUserInfo, ClosePayload, CloseResult, CopyLinkPayload, CopyLinkResult, DirectoryCreatePayload, DirectoryCreateResult, DirectoryExistsPayload, DirectoryExistsResult, DirectoryListPayload, DirectoryListResult, DirectoryRemovePayload, DirectoryRemoveResult, DeleteCurrentUserLeaderboardEntryPayload, DeleteCurrentUserLeaderboardEntryResult, GetCurrentUserLeaderboardEntryPayload, GetCurrentUserLeaderboardEntryResult, GetLeaderboardInfoPayload, GetLeaderboardInfoResult, GetLeaderboardListPayload, GetLeaderboardListResult, GetSteamGameListPayload, GetSteamGameListResult, GetStoragePayload, GetStorageResult, GetUserInfoPayload, GetUserInfoResult, GetWindowInfoPayload, GetWindowInfoResult, DownloadProgressPayload, HideLoadingPayload, HideLoadingResult, FileCreatePayload, FileCreateResult, FileExistsPayload, FileExistsResult, FileReadBytesPayload, FileReadBytesResult, FileReadTextPayload, FileReadTextResult, FileRemovePayload, FileRemoveResult, FileStatPayload, FileStatResult, FileWriteBytesPayload, FileWriteBytesResult, FileWriteTextPayload, FileWriteTextResult, LeaderboardEntry, LeaderboardOrder, LoginPayload, LoginResult, LoginScope, MiniProgramAuthMethod, MiniProgramBridgeError, MiniProgramBridgeCancelMessage, MiniProgramBridgeMessage, MiniProgramBridgeMessageType, MiniProgramBridgeProgressMessage, MiniProgramBridgeMethod, MiniProgramCapabilityDefinition, MiniProgramCapabilityModule, MiniProgramCapabilityPayload, MiniProgramCapabilityPayloadMap, MiniProgramCapabilityResult, MiniProgramCapabilityResultMap, MiniProgramCapabilityRisk, MiniProgramCloudMethod, MiniProgramDeviceMethod, MiniProgramDirectoryDescriptor, MiniProgramDirectoryMethod, MiniProgramDirectoryRef, MiniProgramDirectDirectoryRef, MiniProgramDirectFileRef, MiniProgramEventName, MiniProgramEventPayloadMap, MiniProgramFileDescriptor, MiniProgramFileMode, MiniProgramFileMethod, MiniProgramFileRef, MiniProgramFilesMethod, MiniProgramFileStat, MiniProgramFileSystemEntityDescriptor, MiniProgramFileSystemEntityRef, MiniProgramPathRootRef, MiniProgramSandboxRootRef, MiniProgramNavigationBarForegroundStyle, MiniProgramNavigationMethod, MiniProgramNetworkHeaders, MiniProgramNetworkMethod, MiniProgramNetworkParams, MiniProgramNetworkRequestMethod, MiniProgramRuntimePermissionEntry, MiniProgramRuntimePermissionsSnapshot, MiniProgramRuntimePermissionStatus, MiniProgramSafeArea, MiniProgramScreenshotRect, MiniProgramShareChannel, MiniProgramShareMethod, MiniProgramSharePostOptions, MiniProgramStorageMethod, MiniProgramToastStatus, MiniProgramUiMethod, MiniProgramUserInfoResult, MiniProgramUserMethod, MiniProgramVibrateIntensity, MiniProgramViewportMethod, MiniProgramWindowInfoResult, NetworkRequestPayload, NetworkResponsePayload, NetworkDownloadPayload, NetworkDownloadResult, OpenAppPagePayload, OpenAppPageResult, OpenGameDetailAppPagePayload, OpenPostDetailAppPagePayload, OpenUserDetailAppPagePayload, PickDirectoryPayload, PickDirectoryResult, PickFilesPayload, PickFilesResult, ParsedMiniProgramRuntimePermissions, ReloadPayload, ReloadResult, RevokeAuthorizationPayload, RevokeAuthorizationResult, RuntimeLocationProbePayload, ScreenshotPayload, ScreenshotResult, SaveFilePayload, SaveFileResult, SDKCSPBlockedResourceType, SDKCSPViolationPayload, SDKHandshakePayload, SDKLocationReportPayload, SDKLocationReportTrigger, SetClipboardPayload, SetClipboardResult, SetNavigationBarStylePayload, SetNavigationBarStyleResult, SetStoragePayload, ShowLoadingPayload, ShowLoadingResult, ShowShareMenuPayload, ShowShareMenuResult, ShowToastPayload, ShowToastResult, SteamGameListData, SteamGameListItem, SteamGameListSort, SteamGamePrice, SubmitLeaderboardEntryPayload, SubmitLeaderboardEntryResult, UserInfoAuthorization, UserInfoAuthorizationScope, UserInfoAuthorizationStatus, VibratePayload, VibrateResult, } from '@heybox/hb-sdk-protocol';
3
3
  export type { LoginOptions } from './modules/auth';
4
4
  export type { GetSteamGameListOptions } from './modules/user';
5
5
  export type { MiniProgramEventHandler } from './protocol/types';
6
- export type { MiniProgramNetworkRequestConfig, MiniProgramNetworkResponse, MiniProgramNetworkValidateStatus, } from './modules/network';
6
+ export type { DownloadBaseOptions, DownloadOptions, DownloadProgress, MiniProgramNetworkRequestConfig, MiniProgramNetworkResponse, MiniProgramNetworkValidateStatus, } from './modules/network';
7
+ export type { CreateOptions, DirectoryHandle, FileHandle, FileMode, FileStat, FileSystem, FileSystemEntity, FilesModule, ListOptions, PathRoot, PickDirectoryOptions, PickFilesOptions, RemoveOptions, SaveFileOptions, } from './modules/files';
7
8
  export type { MiniProgramScreenshotOptions, MiniProgramShowShareMenuOptions } from './modules/share';
8
9
  export type { MiniProgramSetNavigationBarStyleOptions } from './modules/viewport';
@@ -1,6 +1,2 @@
1
1
  export declare const HB_SDK_PACKAGE_NAME = "@heybox/hb-sdk";
2
2
  export declare const HB_SDK_SKILL_NAME = "hb-sdk";
3
- export declare const HB_SDK_AGENT_SKILLS_BASE_URL = "https://open.xiaoheihe.cn/agent-skills";
4
- export declare const HB_SDK_SKILL_SOURCE = "https://open.xiaoheihe.cn/agent-skills/hb-sdk";
5
- export declare const HB_SDK_SKILL_INDEX_URL = "https://open.xiaoheihe.cn/agent-skills/.well-known/agent-skills/index.json";
6
- export declare const HB_SDK_SKILL_INSTALL_COMMAND = "npx skills add https://open.xiaoheihe.cn/agent-skills/hb-sdk";
@@ -1,4 +1,5 @@
1
- type MiniappManifestPlugin = {
1
+ import { MINIAPP_PLATFORM_VALUES, type MiniappPlatform } from '../miniapp-manifest/schema';
2
+ export interface MiniappManifestPlugin {
2
3
  name: string;
3
4
  config: (config: MiniappManifestUserConfig) => MiniappManifestUserConfig | void;
4
5
  configResolved: (resolved: MiniappManifestResolvedConfig) => void;
@@ -6,15 +7,15 @@ type MiniappManifestPlugin = {
6
7
  buildEnd: (error?: Error) => void;
7
8
  transformIndexHtml: (html: string) => string;
8
9
  closeBundle: (this: MiniappManifestPluginContext) => Promise<void>;
9
- };
10
- interface MiniappManifestUserConfig {
10
+ }
11
+ export interface MiniappManifestUserConfig {
11
12
  base?: string;
12
13
  define?: Record<string, string>;
13
14
  }
14
- interface MiniappManifestPluginContext {
15
+ export interface MiniappManifestPluginContext {
15
16
  warn: (message: string) => void;
16
17
  }
17
- interface MiniappManifestResolvedConfig {
18
+ export interface MiniappManifestResolvedConfig {
18
19
  root: string;
19
20
  command: 'build' | 'serve';
20
21
  build: {
@@ -31,6 +32,13 @@ interface MiniappManifestResolvedConfig {
31
32
  protocol?: 'ws' | 'wss';
32
33
  };
33
34
  };
35
+ plugins?: readonly {
36
+ name?: string;
37
+ }[];
38
+ }
39
+ export { MINIAPP_PLATFORM_VALUES };
40
+ export type { MiniappPlatform };
41
+ export interface MiniappManifestOptions {
42
+ platforms: readonly MiniappPlatform[];
34
43
  }
35
- export declare function miniappManifest(): MiniappManifestPlugin;
36
- export {};
44
+ export declare function miniappManifest(options: MiniappManifestOptions): MiniappManifestPlugin;
@@ -1,204 +0,0 @@
1
- 'use strict';
2
-
3
- var fs$1 = require('node:fs');
4
- var fs = require('node:fs/promises');
5
- var os = require('node:os');
6
- var path = require('node:path');
7
- var index = require('./index-C9mpajVG.cjs');
8
- require('node:module');
9
- require('path');
10
- require('os');
11
- require('readline');
12
- require('tty');
13
- require('assert');
14
- require('events');
15
- require('stream');
16
- require('buffer');
17
- require('util');
18
-
19
- const DEFAULT_TIMEOUT_MS = 3000;
20
- const PACKAGE_JSON_CANDIDATES = [
21
- path.resolve(__dirname, '..', 'package.json'),
22
- path.resolve(__dirname, '..', '..', 'package.json'),
23
- path.resolve(__dirname, '..', '..', '..', 'package.json'),
24
- ];
25
- async function runDoctorCommand(runtime = {}) {
26
- const logger = runtime.logger ?? index.createCliLogger();
27
- const result = await logger.task('正在检查 Agent Skill 元数据', () => getDoctorResult(runtime), {
28
- successText: 'Agent Skill 检查完成',
29
- });
30
- printDoctorResult(result, logger);
31
- printDoctorNextStep(result, logger);
32
- return result;
33
- }
34
- async function getDoctorResult(runtime = {}) {
35
- const currentSdkVersion = await readCurrentSdkVersion(runtime.packageJsonFiles);
36
- const localSkillJsonPath = await resolveLocalSkillJsonPath(runtime);
37
- let remoteSkill;
38
- try {
39
- remoteSkill = await fetchRemoteSkill(runtime);
40
- }
41
- catch {
42
- return {
43
- currentSdkVersion,
44
- localSkillJsonPath,
45
- status: 'REMOTE_UNAVAILABLE',
46
- };
47
- }
48
- if (remoteSkill?.sdk?.version !== currentSdkVersion) {
49
- return {
50
- currentSdkVersion,
51
- localSkillJsonPath,
52
- remoteSkill,
53
- status: 'SDK_MISMATCH',
54
- };
55
- }
56
- const localSkill = await readLocalSkillManifest(localSkillJsonPath);
57
- if (!localSkill.exists) {
58
- return {
59
- currentSdkVersion,
60
- localSkillJsonPath,
61
- remoteSkill,
62
- status: 'SKILL_MISSING',
63
- };
64
- }
65
- if (!localSkill.manifest ||
66
- localSkill.manifest.name !== index.HB_SDK_SKILL_NAME ||
67
- localSkill.manifest.skillVersion !== remoteSkill.version ||
68
- localSkill.manifest.sdk?.version !== remoteSkill.sdk?.version) {
69
- return {
70
- currentSdkVersion,
71
- localSkillJsonPath,
72
- localSkillVersion: localSkill.manifest?.skillVersion,
73
- remoteSkill,
74
- status: 'SKILL_OUTDATED',
75
- };
76
- }
77
- return {
78
- currentSdkVersion,
79
- localSkillJsonPath,
80
- localSkillVersion: localSkill.manifest.skillVersion,
81
- remoteSkill,
82
- status: 'OK',
83
- };
84
- }
85
- function printDoctorResult(result, logger) {
86
- logger.section('Doctor');
87
- logger.info(`SDK version: ${result.currentSdkVersion}`);
88
- logger.info(`Remote skill: ${result.remoteSkill?.version ? `${result.remoteSkill.version} (sdk ${result.remoteSkill.sdk?.version ?? 'unknown'})` : 'unavailable'}`);
89
- logger.info(`Local skill: ${result.localSkillVersion ?? 'missing'}`);
90
- logger.debug(`Local skill path: ${result.localSkillJsonPath}`);
91
- logger.info(`Status: ${result.status}`);
92
- }
93
- function printDoctorNextStep(result, logger) {
94
- if (result.status === 'OK') {
95
- logger.success('Skill is up to date.');
96
- return;
97
- }
98
- if (result.status === 'SDK_MISMATCH') {
99
- logger.warn(`Current SDK does not match the latest skill metadata. Upgrade with: npm i -D ${index.HB_SDK_PACKAGE_NAME}@latest`);
100
- logger.info(`Then install or refresh the skill manually: ${formatSkillInstallCommand(result)}`);
101
- return;
102
- }
103
- if (result.status === 'REMOTE_UNAVAILABLE') {
104
- logger.warn('Remote skill metadata is unavailable. Try again later.');
105
- logger.info(`Manual install command: ${index.HB_SDK_SKILL_INSTALL_COMMAND}`);
106
- return;
107
- }
108
- logger.info(`Install or refresh the skill manually: ${formatSkillInstallCommand(result)}`);
109
- }
110
- function formatSkillInstallCommand(result) {
111
- return `npx skills add ${result.remoteSkill?.source || index.HB_SDK_SKILL_SOURCE}`;
112
- }
113
- async function fetchRemoteSkill(runtime) {
114
- const fetchImpl = runtime.fetchImpl ?? fetch;
115
- const controller = new AbortController();
116
- const timeout = setTimeout(() => controller.abort(), runtime.timeoutMs ?? DEFAULT_TIMEOUT_MS);
117
- try {
118
- const response = await fetchImpl(runtime.remoteIndexUrl ?? index.HB_SDK_SKILL_INDEX_URL, {
119
- headers: {
120
- accept: 'application/json',
121
- },
122
- signal: controller.signal,
123
- });
124
- if (!response.ok) {
125
- throw new Error(`remote skill index returned ${response.status}`);
126
- }
127
- const index$1 = (await response.json());
128
- const skill = index$1.skills?.find(item => item.name === index.HB_SDK_SKILL_NAME);
129
- if (!skill?.version || skill.sdk?.package !== index.HB_SDK_PACKAGE_NAME || !skill.sdk.version) {
130
- throw new Error('remote hb-sdk skill metadata is incomplete');
131
- }
132
- return skill;
133
- }
134
- finally {
135
- clearTimeout(timeout);
136
- }
137
- }
138
- async function readLocalSkillManifest(skillJsonPath) {
139
- if (!(await pathExists(skillJsonPath))) {
140
- return {
141
- exists: false,
142
- };
143
- }
144
- try {
145
- return {
146
- exists: true,
147
- manifest: JSON.parse(await fs.readFile(skillJsonPath, 'utf8')),
148
- };
149
- }
150
- catch {
151
- return {
152
- exists: true,
153
- };
154
- }
155
- }
156
- async function readCurrentSdkVersion(packageJsonCandidates = PACKAGE_JSON_CANDIDATES) {
157
- for (const candidate of packageJsonCandidates) {
158
- if (!(await pathExists(candidate))) {
159
- continue;
160
- }
161
- const packageJson = JSON.parse(await fs.readFile(candidate, 'utf8'));
162
- if (typeof packageJson.version === 'string' && packageJson.version) {
163
- return packageJson.version;
164
- }
165
- }
166
- throw new Error('未能读取 @heybox/hb-sdk 当前版本号');
167
- }
168
- async function resolveLocalSkillJsonPath(runtime) {
169
- if (runtime.localSkillJsonPath) {
170
- return runtime.localSkillJsonPath;
171
- }
172
- const projectSkillJsonPath = await findProjectSkillJsonPath(runtime.cwd ?? process.cwd());
173
- if (projectSkillJsonPath) {
174
- return projectSkillJsonPath;
175
- }
176
- const codexHome = runtime.codexHome ?? runtime.env?.CODEX_HOME ?? process.env.CODEX_HOME ?? path.join(os.homedir(), '.codex');
177
- return path.join(codexHome, 'skills', index.HB_SDK_SKILL_NAME, 'skill.json');
178
- }
179
- async function findProjectSkillJsonPath(startDir) {
180
- let current = path.resolve(startDir);
181
- while (true) {
182
- const skillJsonPath = path.join(current, '.agents', 'skills', index.HB_SDK_SKILL_NAME, 'skill.json');
183
- if ((await pathExists(path.join(current, 'package.json'))) && (await pathExists(skillJsonPath))) {
184
- return skillJsonPath;
185
- }
186
- const parent = path.dirname(current);
187
- if (parent === current) {
188
- return undefined;
189
- }
190
- current = parent;
191
- }
192
- }
193
- async function pathExists(filePath) {
194
- try {
195
- await fs.access(filePath, fs$1.constants.F_OK);
196
- return true;
197
- }
198
- catch {
199
- return false;
200
- }
201
- }
202
-
203
- exports.getDoctorResult = getDoctorResult;
204
- exports.runDoctorCommand = runDoctorCommand;