@heybox/hb-sdk 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +334 -418
- package/dist/devtools/mock-host/index.html +1 -1
- package/dist/devtools/mock-host/main.js +7 -7
- package/package.json +5 -4
- package/skill/references/api-protocol.md +1 -1
- package/skill/references/api-root.md +1 -1
- package/skill/references/llms-index.md +1 -1
- package/skill/skill.json +4 -4
|
@@ -275,7 +275,7 @@
|
|
|
275
275
|
<button class="primary" id="mac-app-button" type="button">在 Mac 版 APP 中启动</button>
|
|
276
276
|
</div>
|
|
277
277
|
<div class="mac-app-status" id="mac-app-status" hidden>
|
|
278
|
-
<div>如果没有唤起 Mac 版 APP
|
|
278
|
+
<div>如果没有唤起 Mac 版 APP,请在系统浏览器中打开当前调试页面后重试。若 APP 已打开但加载失败,请升级到支持本地小程序调试的 Mac App 版本。</div>
|
|
279
279
|
<div class="debug-page-url">
|
|
280
280
|
<code id="debug-page-url"></code>
|
|
281
281
|
<button
|
|
@@ -127,18 +127,16 @@ const MINI_PROGRAM_PROTOCOL_CAPABILITIES = [
|
|
|
127
127
|
];
|
|
128
128
|
|
|
129
129
|
const MINI_PROGRAM_URL_QUERY_PARAM = 'mini_url';
|
|
130
|
-
const
|
|
131
|
-
const MINI_PROGRAM_DETAIL_URL = 'https://www.xiaoheihe.cn/tools/user_miniprogram/detail';
|
|
130
|
+
const MINI_PROGRAM_DEV_SHELL_URL = 'heybox-mini-dev://sandbox';
|
|
132
131
|
function createMacAppProtocol(appUrl) {
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
detailUrl.searchParams.set(MINI_PROGRAM_DEV_QUERY_PARAM, '1');
|
|
132
|
+
const devShellUrl = new URL(MINI_PROGRAM_DEV_SHELL_URL);
|
|
133
|
+
devShellUrl.searchParams.set(MINI_PROGRAM_URL_QUERY_PARAM, appUrl);
|
|
136
134
|
const protocolPayload = {
|
|
137
135
|
protocol_type: 'openWindow',
|
|
138
136
|
full_screen: true,
|
|
139
137
|
mini_program: '1',
|
|
140
138
|
webview: {
|
|
141
|
-
url:
|
|
139
|
+
url: devShellUrl.toString(),
|
|
142
140
|
pull: false,
|
|
143
141
|
refresh: false,
|
|
144
142
|
},
|
|
@@ -818,8 +816,10 @@ queryElement('#hide-button').addEventListener('click', () => {
|
|
|
818
816
|
postEvent('hide', { timestamp: Date.now(), source: 'mock-host' });
|
|
819
817
|
});
|
|
820
818
|
elements.macAppButton.addEventListener('click', () => {
|
|
819
|
+
const protocol = createMacAppProtocol(miniProgramUrl);
|
|
820
|
+
console.log('[hb-sdk] Mac App launch protocol:', protocol);
|
|
821
821
|
showMacAppLaunchHint();
|
|
822
|
-
window.location.href =
|
|
822
|
+
window.location.href = protocol;
|
|
823
823
|
});
|
|
824
824
|
elements.copyDebugPageUrlButton.addEventListener('click', () => {
|
|
825
825
|
void copyDebugPageUrl();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heybox/hb-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"./vite": {
|
|
28
28
|
"types": "./types/vite/index.d.ts",
|
|
29
|
+
"heybox": "./src/vite/index.ts",
|
|
29
30
|
"import": "./dist/vite.esm.js",
|
|
30
31
|
"require": "./dist/vite.cjs.js",
|
|
31
32
|
"default": "./dist/vite.esm.js"
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
"rimraf": "^5.0.5",
|
|
76
77
|
"rollup": "^4.52.4",
|
|
77
78
|
"typescript": "^5.9.3",
|
|
78
|
-
"vue": "2.7.16",
|
|
79
|
+
"vue": "^2.7.16",
|
|
79
80
|
"vite": "^8.0.12",
|
|
80
81
|
"vitest": "^3.2.4"
|
|
81
82
|
},
|
|
@@ -102,10 +103,10 @@
|
|
|
102
103
|
},
|
|
103
104
|
"scripts": {
|
|
104
105
|
"dev": "vite",
|
|
105
|
-
"build:package": "nx exec -- sh -c \"pnpm run clean && pnpm run build:lib && pnpm run build:cli && pnpm run build:
|
|
106
|
+
"build:package": "nx exec -- sh -c \"pnpm run clean && pnpm run build:lib && pnpm run build:cli && pnpm run build:templates && pnpm run build:types\"",
|
|
106
107
|
"build:watch": "pnpm run build:lib -w & pnpm run build:types -w",
|
|
107
108
|
"build:lib": "rollup -c rollup.config.ts --configPlugin 'typescript={\"tsconfig\":\"tsconfig.build.json\"}'",
|
|
108
|
-
"build:cli": "rollup -c rollup.config.ts --environment HB_SDK_BUILD:cli --configPlugin 'typescript={\"tsconfig\":\"tsconfig.build.json\"}'",
|
|
109
|
+
"build:cli": "rollup -c rollup.config.ts --environment HB_SDK_BUILD:cli --configPlugin 'typescript={\"tsconfig\":\"tsconfig.build.json\"}' && pnpm run build:mock-host",
|
|
109
110
|
"build:mock-host": "node scripts/copy-mock-host.cjs",
|
|
110
111
|
"build:templates": "node scripts/copy-cli-templates.cjs",
|
|
111
112
|
"build:types": "tsc -p tsconfig.dts.json",
|
|
@@ -131,5 +131,5 @@ Reference 由 `packages/hb-sdk` 的公开导出与源码注释自动生成,不
|
|
|
131
131
|
|
|
132
132
|
| 导出面 | Classes | Functions | Interfaces | Types | Constants |
|
|
133
133
|
| --- | ---: | ---: | ---: | ---: | ---: |
|
|
134
|
-
| Root API | 3 |
|
|
134
|
+
| Root API | 3 | 4 | 22 | 17 | 0 |
|
|
135
135
|
| Protocol API | 0 | 1 | 20 | 29 | 13 |
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
## Package metadata
|
|
20
20
|
|
|
21
21
|
- Package: `@heybox/hb-sdk`
|
|
22
|
-
- Version at generation time: `0.3.
|
|
22
|
+
- Version at generation time: `0.3.3`
|
|
23
23
|
- Public root export: `@heybox/hb-sdk`
|
|
24
24
|
- Protocol export: `@heybox/hb-sdk/protocol`
|
|
25
25
|
- Vite plugin export: `@heybox/hb-sdk/vite`
|
|
@@ -24,7 +24,7 @@ This site documents the iframe-side SDK for external mini programs. For AI retri
|
|
|
24
24
|
- [Root API](./llms/reference/root/README.md): 该页面收录从 `src/index.ts` 公开导出的 API。
|
|
25
25
|
- [Protocol API](./llms/reference/protocol/README.md): 该页面收录从 `src/protocol.ts` 公开导出的 API。
|
|
26
26
|
- [Root functions](./llms/reference/root/functions/README.md)
|
|
27
|
-
- [Root interfaces](./llms/reference/root/interfaces/README.md):
|
|
27
|
+
- [Root interfaces](./llms/reference/root/interfaces/README.md): `on/off` 会基于该映射推导 handler 参数类型。 |
|
|
28
28
|
- [Protocol interfaces](./llms/reference/protocol/interfaces/README.md): 所有请求失败都会被规范化成该结构,SDK 侧再包装为 `HbMiniProgramSDKError`。 |
|
|
29
29
|
- [Root types](./llms/reference/root/types/README.md): `user.getInfo` 不需要入参。
|
|
30
30
|
- [Protocol types](./llms/reference/protocol/types/README.md): `user.getInfo` 不需要入参。
|
package/skill/skill.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hb-sdk",
|
|
3
|
-
"skillVersion": "0.3.
|
|
3
|
+
"skillVersion": "0.3.3+skill.cb20a91e9529",
|
|
4
4
|
"sdk": {
|
|
5
5
|
"package": "@heybox/hb-sdk",
|
|
6
|
-
"version": "0.3.
|
|
7
|
-
"compatibility": "0.3.
|
|
6
|
+
"version": "0.3.3",
|
|
7
|
+
"compatibility": "0.3.3"
|
|
8
8
|
},
|
|
9
9
|
"source": "https://open.xiaoheihe.cn/agent-skills/hb-sdk",
|
|
10
|
-
"integrity": "sha256-
|
|
10
|
+
"integrity": "sha256-cb20a91e95291420a1f1d1b8a1601bbf21ba8bcd4dac64265d0c033e009d9456"
|
|
11
11
|
}
|