@heybox/hb-sdk 0.3.1 → 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/README.md CHANGED
@@ -13,7 +13,7 @@ npm install
13
13
  npm run dev
14
14
  ```
15
15
 
16
- 模板默认使用 Vue 3、Vite、TypeScript 和 npm。`npm run dev` 会启动小程序页面服务,并打开 `hb-sdk` 内置的浏览器 mock 宿主环境,适合在普通浏览器里调试 SDK 能力;调试页内可点击按钮在 Mac 版 APP 中启动同一页面。
16
+ 模板默认使用 Vue 3、Vite、TypeScript 和 npm。`npm run dev` 会启动小程序页面服务,并打开 `hb-sdk` 内置的浏览器 mock 宿主环境,适合在普通浏览器里调试 SDK 能力;调试页内可点击按钮在 Mac 版 APP 中启动同一页面。Codex、VSCode 等内嵌浏览器可能无法转交 `heybox://` 协议;需要从调试页唤起 Mac 版 APP 时,请先在系统浏览器中打开调试页。
17
17
 
18
18
  在已有项目中安装:
19
19
 
@@ -57,7 +57,7 @@ SDK 需要在黑盒小程序 iframe 容器内运行。父容器会为页面注
57
57
  npm run dev
58
58
  ```
59
59
 
60
- 调试页会通过 iframe 加载本地页面并补齐小程序 bridge 环境;如果需要真实黑盒小程序容器加载同一页面,点击调试页里的「在 Mac 版 APP 中启动」按钮。
60
+ 调试页会通过 iframe 加载本地页面并补齐小程序 bridge 环境;如果需要真实黑盒小程序容器加载同一页面,点击调试页里的「在 Mac 版 APP 中启动」按钮。Codex、VSCode 等内嵌浏览器可能无法唤起系统 APP;遇到这种情况时,请在系统浏览器中打开同一个调试页后重试。
61
61
 
62
62
  在未使用脚手架的 Vite 项目中,可以把命令加到 `package.json`:
63
63
 
@@ -240,8 +240,9 @@ try {
240
240
  }
241
241
  ```
242
242
  2. 已运行过 `hb-sdk login` 登录 Heybox。
243
- 3. 项目根有 `scripts.build`,会被 CLI 通过 lockfile 自动选用的 `pnpm`、`yarn` 或 `npm` 触发;无 lockfile 时回退 `npm`。
244
- 4. 构建产物落在 `dist/`,包含 `index.html` `manifest.json`。
243
+ 3. 如果需要以公司的名义发布小程序,需先找 @秦浩东 申请小程序开发权限。
244
+ 4. 项目根有 `scripts.build`,会被 CLI 通过 lockfile 自动选用的 `pnpm`、`yarn` `npm` 触发;无 lockfile 时回退 `npm`。
245
+ 5. 构建产物落在 `dist/`,包含 `index.html` 和 `manifest.json`。
245
246
 
246
247
  执行流程:
247
248
 
package/dist/cli.cjs CHANGED
@@ -75856,6 +75856,7 @@ const MOCK_HOST_ROOT_CANDIDATES = [
75856
75856
  ];
75857
75857
  async function startMiniProgramMockHostServer(options) {
75858
75858
  const root = options.root ?? resolveMiniProgramMockHostRoot(options.rootCandidates);
75859
+ assertCompleteMiniProgramMockHostRoot(root);
75859
75860
  const server = createMiniProgramMockHostServer(root, {
75860
75861
  fetchImpl: options.fetchImpl ?? fetch,
75861
75862
  });
@@ -75878,12 +75879,23 @@ async function startMiniProgramMockHostServer(options) {
75878
75879
  };
75879
75880
  }
75880
75881
  function resolveMiniProgramMockHostRoot(candidates = MOCK_HOST_ROOT_CANDIDATES) {
75881
- const found = candidates.find((candidate) => fs$4.existsSync(path.join(candidate, 'index.html')));
75882
+ const found = candidates.find(isCompleteMiniProgramMockHostRoot);
75882
75883
  if (!found) {
75883
- throw new Error('未找到 hb-sdk mock host 静态产物。请先执行 @heybox/hb-sdk 的 build:mock-host。');
75884
+ throw createMissingMockHostError();
75884
75885
  }
75885
75886
  return found;
75886
75887
  }
75888
+ function assertCompleteMiniProgramMockHostRoot(root) {
75889
+ if (!isCompleteMiniProgramMockHostRoot(root)) {
75890
+ throw createMissingMockHostError();
75891
+ }
75892
+ }
75893
+ function isCompleteMiniProgramMockHostRoot(root) {
75894
+ return fs$4.existsSync(path.join(root, 'index.html')) && fs$4.existsSync(path.join(root, 'main.js'));
75895
+ }
75896
+ function createMissingMockHostError() {
75897
+ return new Error('未找到完整的 hb-sdk mock host 静态产物。请先执行 @heybox/hb-sdk 的 build:mock-host。');
75898
+ }
75887
75899
  function createMiniProgramMockHostUrl(options) {
75888
75900
  const url = new URL(`http://${toDisplayHost$1(options.host)}:${options.port}/`);
75889
75901
  url.searchParams.set(MINI_PROGRAM_URL_QUERY_PARAM, options.appUrl);
@@ -76875,6 +76887,7 @@ function hasPackageDependency(packageJson, name) {
76875
76887
  function createViteServerOptions(projectRoot, options) {
76876
76888
  const configFile = resolveProjectViteConfig(projectRoot);
76877
76889
  const server = {
76890
+ cors: true,
76878
76891
  host: options.host,
76879
76892
  port: options.port ?? DEFAULT_APP_PORT,
76880
76893
  strictPort: false,
@@ -77559,7 +77572,7 @@ async function pathExists$1(filePath) {
77559
77572
  }
77560
77573
 
77561
77574
  const CLI_VERSION_PLACEHOLDER = ['__HB', 'SDK', 'CLI', 'VERSION__'].join('_');
77562
- const BUILT_CLI_VERSION = '0.3.1';
77575
+ const BUILT_CLI_VERSION = '0.3.3';
77563
77576
  const PACKAGE_JSON_CANDIDATES = [
77564
77577
  path.resolve(__dirname, '..', '..', 'package.json'),
77565
77578
  path.resolve(__dirname, '..', 'package.json'),
@@ -102,6 +102,65 @@
102
102
  background: #2563eb;
103
103
  }
104
104
 
105
+ .mac-app-status {
106
+ display: grid;
107
+ gap: 8px;
108
+ margin-top: 10px;
109
+ color: #475569;
110
+ font-size: 12px;
111
+ line-height: 1.5;
112
+ }
113
+
114
+ .mac-app-status[hidden] {
115
+ display: none;
116
+ }
117
+
118
+ .debug-page-url {
119
+ display: grid;
120
+ grid-template-columns: minmax(0, 1fr) 32px;
121
+ align-items: center;
122
+ gap: 8px;
123
+ }
124
+
125
+ .debug-page-url code {
126
+ min-width: 0;
127
+ overflow-wrap: anywhere;
128
+ word-break: break-word;
129
+ border: 1px solid #d7dee8;
130
+ border-radius: 6px;
131
+ padding: 7px 8px;
132
+ color: #1f2933;
133
+ background: #fff;
134
+ }
135
+
136
+ .copy-icon-button {
137
+ display: inline-grid;
138
+ place-items: center;
139
+ width: 32px;
140
+ height: 32px;
141
+ border: 1px solid #cad5e2;
142
+ border-radius: 6px;
143
+ padding: 0;
144
+ color: #475569;
145
+ background: #fff;
146
+ cursor: pointer;
147
+ }
148
+
149
+ .copy-icon-button:hover {
150
+ border-color: #2563eb;
151
+ color: #2563eb;
152
+ }
153
+
154
+ .copy-icon-button svg {
155
+ width: 16px;
156
+ height: 16px;
157
+ }
158
+
159
+ .copy-status {
160
+ min-height: 18px;
161
+ color: #64748b;
162
+ }
163
+
105
164
  .field {
106
165
  display: grid;
107
166
  gap: 6px;
@@ -215,7 +274,25 @@
215
274
  <div class="actions" style="margin-top: 10px">
216
275
  <button class="primary" id="mac-app-button" type="button">在 Mac 版 APP 中启动</button>
217
276
  </div>
218
- <pre id="mac-app-status"></pre>
277
+ <div class="mac-app-status" id="mac-app-status" hidden>
278
+ <div>如果没有唤起 Mac 版 APP,请在系统浏览器中打开当前调试页面后重试。若 APP 已打开但加载失败,请升级到支持本地小程序调试的 Mac App 版本。</div>
279
+ <div class="debug-page-url">
280
+ <code id="debug-page-url"></code>
281
+ <button
282
+ class="copy-icon-button"
283
+ id="copy-debug-page-url-button"
284
+ type="button"
285
+ aria-label="复制调试页面地址"
286
+ title="复制调试页面地址"
287
+ >
288
+ <svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2">
289
+ <rect x="9" y="9" width="13" height="13" rx="2" />
290
+ <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
291
+ </svg>
292
+ </button>
293
+ </div>
294
+ <div class="copy-status" id="debug-page-copy-status"></div>
295
+ </div>
219
296
  </section>
220
297
 
221
298
  <section class="block">
@@ -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 MINI_PROGRAM_DEV_QUERY_PARAM = 'hb_mini_dev';
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 detailUrl = new URL(MINI_PROGRAM_DETAIL_URL);
134
- detailUrl.searchParams.set(MINI_PROGRAM_URL_QUERY_PARAM, appUrl);
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: detailUrl.toString(),
139
+ url: devShellUrl.toString(),
142
140
  pull: false,
143
141
  refresh: false,
144
142
  },
@@ -772,6 +770,9 @@ let currentUser = {
772
770
  };
773
771
  const elements = {
774
772
  bridgeStatus: queryElement('#bridge-status'),
773
+ copyDebugPageUrlButton: queryElement('#copy-debug-page-url-button'),
774
+ debugPageCopyStatus: queryElement('#debug-page-copy-status'),
775
+ debugPageUrl: queryElement('#debug-page-url'),
775
776
  device: queryElement('#device'),
776
777
  logs: queryElement('#logs'),
777
778
  macAppButton: queryElement('#mac-app-button'),
@@ -815,8 +816,13 @@ queryElement('#hide-button').addEventListener('click', () => {
815
816
  postEvent('hide', { timestamp: Date.now(), source: 'mock-host' });
816
817
  });
817
818
  elements.macAppButton.addEventListener('click', () => {
818
- elements.macAppStatus.textContent = '已尝试唤起 Mac 版 APP';
819
- window.location.href = createMacAppProtocol(miniProgramUrl);
819
+ const protocol = createMacAppProtocol(miniProgramUrl);
820
+ console.log('[hb-sdk] Mac App launch protocol:', protocol);
821
+ showMacAppLaunchHint();
822
+ window.location.href = protocol;
823
+ });
824
+ elements.copyDebugPageUrlButton.addEventListener('click', () => {
825
+ void copyDebugPageUrl();
820
826
  });
821
827
  function createBrowserMockRuntimeAdapter() {
822
828
  return {
@@ -1053,6 +1059,41 @@ function updateUserStatus() {
1053
1059
  function updateStorageSnapshot() {
1054
1060
  elements.storageSnapshot.textContent = JSON.stringify(Object.fromEntries(Array.from(storage.entries()).map(([key, value]) => [key, safeJsonParse(value)])), null, 2);
1055
1061
  }
1062
+ function showMacAppLaunchHint() {
1063
+ elements.debugPageUrl.textContent = location.href;
1064
+ elements.debugPageCopyStatus.textContent = '';
1065
+ elements.macAppStatus.hidden = false;
1066
+ }
1067
+ async function copyDebugPageUrl() {
1068
+ try {
1069
+ await copyText(location.href);
1070
+ elements.debugPageCopyStatus.textContent = '已复制调试页面地址';
1071
+ }
1072
+ catch {
1073
+ elements.debugPageCopyStatus.textContent = '复制失败,请手动复制调试页面地址';
1074
+ }
1075
+ }
1076
+ async function copyText(value) {
1077
+ if (navigator.clipboard?.writeText) {
1078
+ await navigator.clipboard.writeText(value);
1079
+ return;
1080
+ }
1081
+ const textarea = document.createElement('textarea');
1082
+ textarea.value = value;
1083
+ textarea.setAttribute('readonly', '');
1084
+ textarea.style.position = 'fixed';
1085
+ textarea.style.left = '-9999px';
1086
+ document.body.appendChild(textarea);
1087
+ textarea.select();
1088
+ try {
1089
+ if (!document.execCommand('copy')) {
1090
+ throw new Error('copy command failed');
1091
+ }
1092
+ }
1093
+ finally {
1094
+ textarea.remove();
1095
+ }
1096
+ }
1056
1097
  function pushLog(method, detail) {
1057
1098
  logs.unshift({
1058
1099
  method,
@@ -15,7 +15,7 @@ npm run deploy
15
15
 
16
16
  ## 开发模式
17
17
 
18
- - `npm run dev`:启动本地 Vite 服务和 `hb-sdk` 内置 mock runtime host,适合本地调试 SDK 能力;调试页内可点击按钮在 Mac 版 APP 中启动同一页面。
18
+ - `npm run dev`:启动本地 Vite 服务和 `hb-sdk` 内置 mock runtime host,适合本地调试 SDK 能力;调试页内可点击按钮在 Mac 版 APP 中启动同一页面。Codex、VSCode 等内嵌浏览器可能无法唤起系统 APP,需要时请在系统浏览器中打开同一个调试页后重试。
19
19
  - `npm run build`:先执行 TypeScript 检查,再构建生产产物。
20
20
  - `npm run deploy`:构建并发布当前小程序。发布前需要先把 `package.json` 中的 `heybox.miniProgramId` 改成后台分配的真实小程序 id,并执行过 `npx hb-sdk login`。
21
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heybox/hb-sdk",
3
- "version": "0.3.1",
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:mock-host && pnpm run build:templates && pnpm run build:types\"",
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",
package/skill/SKILL.md CHANGED
@@ -50,7 +50,7 @@ Apply these instructions when writing, reviewing, or debugging code that consume
50
50
  2. Use `hb-sdk dev` for local browser debugging through the built-in mock runtime host.
51
51
  3. Use `hb-sdk deploy` to build and publish the current project. It reads `package.json.heybox.miniProgramId`, runs the project's `build` script via the package manager auto-detected by lockfile, then uploads `dist/` to CDN (skipping `manifest.json`, `.DS_Store`, `.map`) and calls the publish API.
52
52
  4. Use `hb-sdk deploy --skip-build` only when the `dist/` directory is already prepared by an upstream CI stage. Missing `dist/manifest.json` or `dist/index.html` aborts the run.
53
- 5. Use the Mock runtime host's "在 Mac 版 APP 中启动" button when the page needs to be loaded by the real Heybox mini-program container.
53
+ 5. Use the Mock runtime host's "在 Mac 版 APP 中启动" button when the page needs to be loaded by the real Heybox mini-program container; if the mock host is open inside Codex, VSCode, or another embedded browser, ask the user to open the same debug page in the system browser before retrying because embedded browsers may block the `heybox://` protocol handoff.
54
54
  6. Use `--port`, `--mock-port`, `--host`, and `--no-open` when the default Vite/mock ports, host, or browser opening behavior need to be controlled.
55
55
  7. Use `hb-sdk login`, `hb-sdk login status`, and `hb-sdk login clear` only for the CLI's own Heybox auth cache.
56
56
  8. Use `hb-sdk doctor` to diagnose whether the local `hb-sdk` skill matches the installed SDK and remote latest skill metadata.
@@ -131,5 +131,5 @@ Reference 由 `packages/hb-sdk` 的公开导出与源码注释自动生成,不
131
131
 
132
132
  | 导出面 | Classes | Functions | Interfaces | Types | Constants |
133
133
  | --- | ---: | ---: | ---: | ---: | ---: |
134
- | Root API | 3 | 5 | 28 | 29 | 12 |
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.1`
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`
@@ -198,7 +198,7 @@ npm install
198
198
  npm run dev
199
199
  ```
200
200
 
201
- 模板默认使用 Vue 3、Vite、TypeScript 和 npm。`npm run dev` 会启动小程序页面服务,并打开 `hb-sdk` 内置的浏览器 mock 宿主环境,适合在普通浏览器里调试 SDK 能力;调试页内可点击按钮在 Mac 版 APP 中启动同一页面。
201
+ 模板默认使用 Vue 3、Vite、TypeScript 和 npm。`npm run dev` 会启动小程序页面服务,并打开 `hb-sdk` 内置的浏览器 mock 宿主环境,适合在普通浏览器里调试 SDK 能力;调试页内可点击按钮在 Mac 版 APP 中启动同一页面。Codex、VSCode 等内嵌浏览器可能无法转交 `heybox://` 协议;需要从调试页唤起 Mac 版 APP 时,请先在系统浏览器中打开调试页。
202
202
 
203
203
  在已有项目中安装:
204
204
 
@@ -242,7 +242,7 @@ SDK 需要在黑盒小程序 iframe 容器内运行。父容器会为页面注
242
242
  npm run dev
243
243
  ```
244
244
 
245
- 调试页会通过 iframe 加载本地页面并补齐小程序 bridge 环境;如果需要真实黑盒小程序容器加载同一页面,点击调试页里的「在 Mac 版 APP 中启动」按钮。
245
+ 调试页会通过 iframe 加载本地页面并补齐小程序 bridge 环境;如果需要真实黑盒小程序容器加载同一页面,点击调试页里的「在 Mac 版 APP 中启动」按钮。Codex、VSCode 等内嵌浏览器可能无法唤起系统 APP;遇到这种情况时,请在系统浏览器中打开同一个调试页后重试。
246
246
 
247
247
  在未使用脚手架的 Vite 项目中,可以把命令加到 `package.json`:
248
248
 
@@ -228,7 +228,7 @@ Agent rules:
228
228
  hb-sdk dev
229
229
  ```
230
230
 
231
- `hb-sdk dev` 会从当前目录向上查找最近的 `package.json` 作为项目根目录,加载该项目安装的 `vite`,并优先使用项目内的 Vite 配置文件。命令会同时启动内置 mock runtime host 并默认打开调试页;如果需要真实黑盒小程序容器加载同一页面,点击调试页里的「在 Mac 版 APP 中启动」按钮。项目没有安装 Vite 时,命令会提示安装依赖或把 Vite 放到 `devDependencies`。
231
+ `hb-sdk dev` 会从当前目录向上查找最近的 `package.json` 作为项目根目录,加载该项目安装的 `vite`,并优先使用项目内的 Vite 配置文件。命令会同时启动内置 mock runtime host 并默认打开调试页;如果需要真实黑盒小程序容器加载同一页面,点击调试页里的「在 Mac 版 APP 中启动」按钮。Codex、VSCode 等内嵌浏览器可能无法转交 `heybox://` 协议;需要从调试页唤起 Mac 版 APP 时,请先在系统浏览器中打开调试页。项目没有安装 Vite 时,命令会提示安装依赖或把 Vite 放到 `devDependencies`。
232
232
 
233
233
  常用参数:
234
234
 
@@ -241,13 +241,13 @@ hb-sdk dev
241
241
 
242
242
  ## Mock runtime 边界
243
243
 
244
- `hb-sdk dev` 会把实际小程序页面地址编码到 mock host 的 `mini_url` query 中,由 mock host iframe 加载页面并补齐小程序 bridge 环境。mock host 内置登录/登出、`show`、`hide`、在 Mac 版 APP 中启动等调试按钮,并通过同一份 devtools-only runtime adapter 处理 SDK 能力调用。
244
+ `hb-sdk dev` 会把实际小程序页面地址编码到 mock host 的 `mini_url` query 中,由 mock host iframe 加载页面并补齐小程序 bridge 环境。mock host 内置登录/登出、`show`、`hide`、在 Mac 版 APP 中启动等调试按钮,并通过同一份 devtools-only runtime adapter 处理 SDK 能力调用。Codex、VSCode 等内嵌浏览器可能无法唤起系统 APP;遇到这种情况时,请在系统浏览器中打开同一个调试页后重试。
245
245
 
246
246
  不要为了本地调试再创建独立 mock runtime 包。CLI、模板和 mock host 都归属 `@heybox/hb-sdk`。
247
247
 
248
248
  本地 mock runtime 下的 `network.request()` 会通过 `hb-sdk` 本地 mock network proxy 转发真实 HTTP(S) 请求,用于避免浏览器 CORS 影响本地调试。proxy 不会把黑盒客户端私有协议字段暴露给 iframe 业务代码。
249
249
 
250
- Use `hb-sdk dev` for local browser SDK debugging. Use the Mock runtime host's "在 Mac 版 APP 中启动" button when the page needs to be loaded by the real Heybox mini-program container.
250
+ Use `hb-sdk dev` for local browser SDK debugging. Use the Mock runtime host's "在 Mac 版 APP 中启动" button when the page needs to be loaded by the real Heybox mini-program container. If the mock host is open inside Codex, VSCode, or another embedded browser, ask the user to open the same debug page in the system browser before retrying because embedded browsers may block the `heybox://` protocol handoff.
251
251
 
252
252
  ## CLI login cache
253
253
 
@@ -348,7 +348,7 @@ npm run deploy
348
348
 
349
349
  ## 开发模式
350
350
 
351
- - `npm run dev`:启动本地 Vite 服务和 `hb-sdk` 内置 mock runtime host,适合本地调试 SDK 能力;调试页内可点击按钮在 Mac 版 APP 中启动同一页面。
351
+ - `npm run dev`:启动本地 Vite 服务和 `hb-sdk` 内置 mock runtime host,适合本地调试 SDK 能力;调试页内可点击按钮在 Mac 版 APP 中启动同一页面。Codex、VSCode 等内嵌浏览器可能无法唤起系统 APP,需要时请在系统浏览器中打开同一个调试页后重试。
352
352
  - `npm run build`:先执行 TypeScript 检查,再构建生产产物。
353
353
  - `npm run deploy`:构建并发布当前小程序。发布前需要先把 `package.json` 中的 `heybox.miniProgramId` 改成后台分配的真实小程序 id,并执行过 `npx hb-sdk login`。
354
354
 
@@ -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): 所有请求失败都会被规范化成该结构,SDK 侧再包装为 `HbMiniProgramSDKError`。 |
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` 不需要入参。
@@ -326,7 +326,7 @@ Agent rules:
326
326
 
327
327
  ${cliDevSection}
328
328
 
329
- Use \`hb-sdk dev\` for local browser SDK debugging. Use the Mock runtime host's "在 Mac 版 APP 中启动" button when the page needs to be loaded by the real Heybox mini-program container.
329
+ Use \`hb-sdk dev\` for local browser SDK debugging. Use the Mock runtime host's "在 Mac 版 APP 中启动" button when the page needs to be loaded by the real Heybox mini-program container. If the mock host is open inside Codex, VSCode, or another embedded browser, ask the user to open the same debug page in the system browser before retrying because embedded browsers may block the \`heybox://\` protocol handoff.
330
330
 
331
331
  ## CLI login cache
332
332
 
package/skill/skill.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "hb-sdk",
3
- "skillVersion": "0.3.1+skill.3af1f225a627",
3
+ "skillVersion": "0.3.3+skill.cb20a91e9529",
4
4
  "sdk": {
5
5
  "package": "@heybox/hb-sdk",
6
- "version": "0.3.1",
7
- "compatibility": "0.3.1"
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-3af1f225a627e3a1f6f4e01a98cc4e38bc571cb911a0e27cf0919784c6b9014f"
10
+ "integrity": "sha256-cb20a91e95291420a1f1d1b8a1601bbf21ba8bcd4dac64265d0c033e009d9456"
11
11
  }