@heybox/hb-sdk 0.5.11 → 0.5.12

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
@@ -330,7 +330,7 @@ await network.request({
330
330
 
331
331
  ## 生命周期事件
332
332
 
333
- 使用 `on()` 监听父容器派发的小程序事件。`on()` 会返回取消监听函数,组件卸载或页面销毁时应及时调用。
333
+ SDK 实例创建后会自动开始与父容器握手。使用 `on()` 监听父容器派发的小程序事件时,默认单例会被懒创建并自动开始握手;`on()` 会返回取消监听函数,组件卸载或页面销毁时应及时调用。
334
334
 
335
335
  ```ts
336
336
  import { on } from '@heybox/hb-sdk';
@@ -516,7 +516,8 @@ CLI 登录态只供 CLI 命令访问黑盒接口时复用,不会注入 iframe
516
516
 
517
517
  ## 能力边界
518
518
 
519
- - 调用模块能力前会自动等待 `ready()`,但业务仍建议在页面启动阶段显式 `await ready()`,便于集中处理握手失败。
519
+ - SDK 实例创建后会自动开始握手;默认单例仍按需懒创建,`ready()`、`on()` 或任意模块能力调用都会创建默认单例并开始握手。
520
+ - `ready()` 只等待已有握手结果,不主动触发新的握手;调用模块能力前会自动等待 `ready()`,但业务仍建议在页面启动阶段显式 `await ready()`,便于集中处理握手失败。
520
521
  - `user.getInfo()`、`user.getCurrentUserDetail()`、`user.getCurrentUserProfile()`、`user.getPlatformAccountOverview()`、`user.getPlatformAccountInfo(platform)` 和 `user.getSteamGameList(options)` 不会触发登录;登录必须由业务在用户操作后调用 `auth.login()`。
521
522
  - 当前用户详情和平台账号 API 只允许读取当前登录用户,不支持传入 `userid` 查询其他人,也不透传 `/account/home_v2/` 原始响应。
522
523
  - 分享、截图、UI、设备、导航、storage 和网络请求只开放稳定窄接口,不透传黑盒客户端内部协议参数。
@@ -580,9 +581,9 @@ export default defineConfig({
580
581
  pnpm --filter @heybox/hb-sdk run test:unit
581
582
  pnpm --filter @heybox/hb-sdk run build:package
582
583
  pnpm --filter @heybox/hb-sdk run check:boundary
583
- pnpm --filter @heybox/hb-sdk run check:docs-sync
584
+ pnpm exec hbexec hb-sdk check
584
585
  ```
585
586
 
586
587
  `check:boundary` 用于保护 SDK、CLI、mock host 与 runtime 之间的依赖边界。调整 CLI、mock 或协议导出时应一起运行。
587
588
 
588
- `check:docs-sync` 用于校验 `README`、文档站 llms 镜像、skill references 与公开 `agent-skills` payload 没有漏同步。维护清单见 `packages/hb-sdk/DOC_SYNC_CHECKLIST.md`。
589
+ `hbexec hb-sdk check` 只读校验 docs、skill references,并在临时目录生成与校验 `agent-skills` payload;不要求 canonical artifact 已存在,也不包含 changelog。维护清单见 `packages/hb-sdk/DOC_SYNC_CHECKLIST.md`。
@@ -5,7 +5,7 @@ var fs = require('node:fs/promises');
5
5
  var path = require('node:path');
6
6
  var require$$0 = require('fs');
7
7
  var require$$1 = require('path');
8
- var index = require('./index-BROIiSNN.cjs');
8
+ var index = require('./index-DeamIV1-.cjs');
9
9
  require('node:module');
10
10
  require('os');
11
11
  require('readline');
@@ -9,7 +9,7 @@ var node_url = require('node:url');
9
9
  var net = require('node:net');
10
10
  var node_http = require('node:http');
11
11
  var browser = require('./browser-RAy8e8cV.cjs');
12
- var index = require('./index-BROIiSNN.cjs');
12
+ var index = require('./index-DeamIV1-.cjs');
13
13
  require('node:process');
14
14
  require('node:buffer');
15
15
  require('node:util');
@@ -4,7 +4,7 @@ var fs$1 = require('node:fs');
4
4
  var fs = require('node:fs/promises');
5
5
  var os = require('node:os');
6
6
  var path = require('node:path');
7
- var index = require('./index-BROIiSNN.cjs');
7
+ var index = require('./index-DeamIV1-.cjs');
8
8
  require('node:module');
9
9
  require('path');
10
10
  require('os');
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var index$2 = require('./index-BROIiSNN.cjs');
3
+ var index$2 = require('./index-DeamIV1-.cjs');
4
4
  var require$$0$2 = require('fs');
5
5
  var require$$2$1 = require('crypto');
6
6
  var require$$1$2 = require('path');
7
7
  var require$$0$3 = require('assert');
8
8
  var require$$4$2 = require('events');
9
9
  var require$$1$1 = require('util');
10
- var remote = require('./remote-ChGmIJC1.cjs');
10
+ var remote = require('./remote-gXUjRvGB.cjs');
11
11
  var require$$0$5 = require('net');
12
12
  var require$$0$4 = require('url');
13
13
  var require$$2$2 = require('http');
@@ -234,19 +234,19 @@ function requireArgument () {
234
234
 
235
235
  var command = {};
236
236
 
237
- const require$5 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-BROIiSNN.cjs', document.baseURI).href)));
237
+ const require$5 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-DeamIV1-.cjs', document.baseURI).href)));
238
238
  function __require$4() { return require$5("node:events"); }
239
239
 
240
- const require$4 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-BROIiSNN.cjs', document.baseURI).href)));
240
+ const require$4 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-DeamIV1-.cjs', document.baseURI).href)));
241
241
  function __require$3() { return require$4("node:child_process"); }
242
242
 
243
- const require$3 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-BROIiSNN.cjs', document.baseURI).href)));
243
+ const require$3 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-DeamIV1-.cjs', document.baseURI).href)));
244
244
  function __require$2() { return require$3("node:path"); }
245
245
 
246
- const require$2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-BROIiSNN.cjs', document.baseURI).href)));
246
+ const require$2 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-DeamIV1-.cjs', document.baseURI).href)));
247
247
  function __require$1() { return require$2("node:fs"); }
248
248
 
249
- const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-BROIiSNN.cjs', document.baseURI).href)));
249
+ const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli-chunks/index-DeamIV1-.cjs', document.baseURI).href)));
250
250
  function __require() { return require$1("node:process"); }
251
251
 
252
252
  var help = {};
@@ -13094,7 +13094,7 @@ function readErrorMessage(error, options = {}) {
13094
13094
  }
13095
13095
 
13096
13096
  const CLI_VERSION_PLACEHOLDER = ['__HB', 'SDK', 'CLI', 'VERSION__'].join('_');
13097
- const BUILT_CLI_VERSION = '0.5.11';
13097
+ const BUILT_CLI_VERSION = '0.5.12';
13098
13098
  const PACKAGE_JSON_CANDIDATES = [
13099
13099
  path.resolve(__dirname, '..', '..', 'package.json'),
13100
13100
  path.resolve(__dirname, '..', 'package.json'),
@@ -13411,31 +13411,31 @@ function createCommandLoggerResolver(options) {
13411
13411
  };
13412
13412
  }
13413
13413
  const defaultClearLoginStatus = async (...args) => {
13414
- const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-BejyA1mX.cjs'); });
13414
+ const { clearLoginStatus } = await Promise.resolve().then(function () { return require('./login-DMNap0-y.cjs'); });
13415
13415
  return clearLoginStatus(...args);
13416
13416
  };
13417
13417
  const defaultLoginToHeybox = async (...args) => {
13418
- const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-BejyA1mX.cjs'); });
13418
+ const { loginToHeybox } = await Promise.resolve().then(function () { return require('./login-DMNap0-y.cjs'); });
13419
13419
  return loginToHeybox(...args);
13420
13420
  };
13421
13421
  const defaultPrintLoginStatus = async (...args) => {
13422
- const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-BejyA1mX.cjs'); });
13422
+ const { printLoginStatus } = await Promise.resolve().then(function () { return require('./login-DMNap0-y.cjs'); });
13423
13423
  return printLoginStatus(...args);
13424
13424
  };
13425
13425
  const defaultRunCreateCommand = async (...args) => {
13426
- const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-BaqN3jeW.cjs'); });
13426
+ const { runCreateCommand } = await Promise.resolve().then(function () { return require('./create-Ba353lSg.cjs'); });
13427
13427
  return runCreateCommand(...args);
13428
13428
  };
13429
13429
  const defaultRunDevCommand = async (...args) => {
13430
- const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-DUZgcgYE.cjs'); });
13430
+ const { runDevCommand } = await Promise.resolve().then(function () { return require('./dev-BhPFNef-.cjs'); });
13431
13431
  return runDevCommand(...args);
13432
13432
  };
13433
13433
  const defaultRunDoctorCommand = async (...args) => {
13434
- const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-DUjQij7b.cjs'); });
13434
+ const { runDoctorCommand } = await Promise.resolve().then(function () { return require('./doctor-CP4kwgAn.cjs'); });
13435
13435
  return runDoctorCommand(...args);
13436
13436
  };
13437
13437
  const defaultRunRemoteCommand = async (...args) => {
13438
- const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-ChGmIJC1.cjs'); }).then(function (n) { return n.remote; });
13438
+ const { runRemoteCommand } = await Promise.resolve().then(function () { return require('./remote-gXUjRvGB.cjs'); }).then(function (n) { return n.remote; });
13439
13439
  return runRemoteCommand(...args);
13440
13440
  };
13441
13441
  function resolveStandaloneLogger(options, verbose) {
@@ -3,9 +3,9 @@
3
3
  var promises = require('node:readline/promises');
4
4
  var node_crypto = require('node:crypto');
5
5
  var node_http = require('node:http');
6
- var session = require('./session-jHF9KWBo.cjs');
6
+ var session = require('./session-D5Vf-fNZ.cjs');
7
7
  var browser = require('./browser-RAy8e8cV.cjs');
8
- var index = require('./index-BROIiSNN.cjs');
8
+ var index = require('./index-DeamIV1-.cjs');
9
9
  require('node:path');
10
10
  require('fs');
11
11
  require('constants');
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  var promises = require('node:readline/promises');
4
- var session = require('./session-jHF9KWBo.cjs');
4
+ var session = require('./session-D5Vf-fNZ.cjs');
5
5
  var childProcess = require('node:child_process');
6
6
  var fs = require('node:fs');
7
7
  var fs$1 = require('node:fs/promises');
8
8
  var path = require('node:path');
9
- var index = require('./index-BROIiSNN.cjs');
9
+ var index = require('./index-DeamIV1-.cjs');
10
10
 
11
11
  var re = {exports: {}};
12
12
 
@@ -3115,7 +3115,7 @@ async function createDefaultCosClient(uploadToken) {
3115
3115
  };
3116
3116
  }
3117
3117
  async function loadCosConstructor() {
3118
- const cosModule = await Promise.resolve().then(function () { return require('./index-6W5M4MLF.cjs'); }).then(function (n) { return n.index; });
3118
+ const cosModule = await Promise.resolve().then(function () { return require('./index-BfpHPA6k.cjs'); }).then(function (n) { return n.index; });
3119
3119
  return cosModule.default;
3120
3120
  }
3121
3121
  function formatSize(bytes) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BROIiSNN.cjs');
3
+ var index = require('./index-DeamIV1-.cjs');
4
4
  var node_crypto = require('node:crypto');
5
5
  var path = require('node:path');
6
6
  var require$$0$2 = require('fs');
package/dist/cli.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./cli-chunks/index-BROIiSNN.cjs');
3
+ var index = require('./cli-chunks/index-DeamIV1-.cjs');
4
4
  require('node:module');
5
5
  require('node:fs');
6
6
  require('node:fs/promises');
package/dist/index.cjs.js CHANGED
@@ -211,6 +211,8 @@ class MiniProgramBridgeClient {
211
211
  readyTimer;
212
212
  handshakeRetryTimer;
213
213
  destroyed = false;
214
+ runtimeUnavailable = false;
215
+ runtimeUnavailableError;
214
216
  constructor(options = {}) {
215
217
  this.timeout = options.timeout || DEFAULT_TIMEOUT;
216
218
  this.selfWindow = options.selfWindow || getGlobalWindow();
@@ -224,15 +226,14 @@ class MiniProgramBridgeClient {
224
226
  this.rejectReady = reject;
225
227
  });
226
228
  this.readyPromise.catch(() => undefined);
229
+ this.ensureStarted();
227
230
  }
228
231
  /** 等待父容器握手完成。 */
229
232
  ready() {
230
- this.ensureStarted();
231
233
  return this.readyPromise;
232
234
  }
233
235
  /** 注册小程序事件监听。 */
234
236
  on(eventName, handler) {
235
- this.ensureStarted();
236
237
  return this.eventBus.on(eventName, handler);
237
238
  }
238
239
  /** 移除小程序事件监听。 */
@@ -241,7 +242,19 @@ class MiniProgramBridgeClient {
241
242
  }
242
243
  /** 调用父容器开放能力。 */
243
244
  async request(method, ...args) {
245
+ if (this.destroyed) {
246
+ throw createSDKError('SDK_DESTROYED', '小程序 SDK 已销毁');
247
+ }
248
+ if (this.runtimeUnavailable) {
249
+ throw this.getRuntimeUnavailableError();
250
+ }
244
251
  await this.ready();
252
+ if (this.destroyed) {
253
+ throw createSDKError('SDK_DESTROYED', '小程序 SDK 已销毁');
254
+ }
255
+ if (this.runtimeUnavailable) {
256
+ throw this.getRuntimeUnavailableError();
257
+ }
245
258
  const payload = args[0];
246
259
  const id = createMessageId();
247
260
  const message = {
@@ -286,6 +299,10 @@ class MiniProgramBridgeClient {
286
299
  this.failReady(createSDKError('SDK_DESTROYED', '小程序 SDK 已销毁'));
287
300
  return;
288
301
  }
302
+ if (this.runtimeUnavailable) {
303
+ this.failReady(this.getRuntimeUnavailableError());
304
+ return;
305
+ }
289
306
  if (this.started) {
290
307
  return;
291
308
  }
@@ -305,7 +322,14 @@ class MiniProgramBridgeClient {
305
322
  try {
306
323
  this.postHandshake();
307
324
  this.handshakeRetryTimer = setInterval(() => {
308
- this.postHandshake();
325
+ try {
326
+ this.postHandshake();
327
+ }
328
+ catch (error) {
329
+ this.failReady(error instanceof HbMiniProgramSDKError
330
+ ? error
331
+ : createSDKError('HANDSHAKE_FAILED', '小程序沙盒握手发送失败', error));
332
+ }
309
333
  }, HANDSHAKE_RETRY_INTERVAL);
310
334
  }
311
335
  catch (error) {
@@ -348,7 +372,10 @@ class MiniProgramBridgeClient {
348
372
  }
349
373
  handleEvent(message) {
350
374
  const eventName = message.method;
351
- if (eventName === 'ready') {
375
+ if (eventName === 'unload') {
376
+ this.markRuntimeUnavailable();
377
+ }
378
+ else if (eventName === 'ready' && !this.runtimeUnavailable) {
352
379
  this.resolveReadyOnce();
353
380
  }
354
381
  this.eventBus.emit(eventName, message.payload);
@@ -401,6 +428,22 @@ class MiniProgramBridgeClient {
401
428
  this.handshakeRetryTimer = undefined;
402
429
  }
403
430
  }
431
+ markRuntimeUnavailable() {
432
+ if (this.runtimeUnavailable) {
433
+ return;
434
+ }
435
+ const error = this.getRuntimeUnavailableError();
436
+ this.runtimeUnavailable = true;
437
+ this.clearReadyTimers();
438
+ this.failReady(error);
439
+ this.rejectAllPending(error);
440
+ }
441
+ getRuntimeUnavailableError() {
442
+ if (!this.runtimeUnavailableError) {
443
+ this.runtimeUnavailableError = createSDKError('RUNTIME_UNAVAILABLE', '小程序运行时已卸载');
444
+ }
445
+ return this.runtimeUnavailableError;
446
+ }
404
447
  rejectAllPending(error) {
405
448
  this.pendingRequests.forEach(pending => {
406
449
  clearTimeout(pending.timer);
package/dist/index.esm.js CHANGED
@@ -207,6 +207,8 @@ class MiniProgramBridgeClient {
207
207
  readyTimer;
208
208
  handshakeRetryTimer;
209
209
  destroyed = false;
210
+ runtimeUnavailable = false;
211
+ runtimeUnavailableError;
210
212
  constructor(options = {}) {
211
213
  this.timeout = options.timeout || DEFAULT_TIMEOUT;
212
214
  this.selfWindow = options.selfWindow || getGlobalWindow();
@@ -220,15 +222,14 @@ class MiniProgramBridgeClient {
220
222
  this.rejectReady = reject;
221
223
  });
222
224
  this.readyPromise.catch(() => undefined);
225
+ this.ensureStarted();
223
226
  }
224
227
  /** 等待父容器握手完成。 */
225
228
  ready() {
226
- this.ensureStarted();
227
229
  return this.readyPromise;
228
230
  }
229
231
  /** 注册小程序事件监听。 */
230
232
  on(eventName, handler) {
231
- this.ensureStarted();
232
233
  return this.eventBus.on(eventName, handler);
233
234
  }
234
235
  /** 移除小程序事件监听。 */
@@ -237,7 +238,19 @@ class MiniProgramBridgeClient {
237
238
  }
238
239
  /** 调用父容器开放能力。 */
239
240
  async request(method, ...args) {
241
+ if (this.destroyed) {
242
+ throw createSDKError('SDK_DESTROYED', '小程序 SDK 已销毁');
243
+ }
244
+ if (this.runtimeUnavailable) {
245
+ throw this.getRuntimeUnavailableError();
246
+ }
240
247
  await this.ready();
248
+ if (this.destroyed) {
249
+ throw createSDKError('SDK_DESTROYED', '小程序 SDK 已销毁');
250
+ }
251
+ if (this.runtimeUnavailable) {
252
+ throw this.getRuntimeUnavailableError();
253
+ }
241
254
  const payload = args[0];
242
255
  const id = createMessageId();
243
256
  const message = {
@@ -282,6 +295,10 @@ class MiniProgramBridgeClient {
282
295
  this.failReady(createSDKError('SDK_DESTROYED', '小程序 SDK 已销毁'));
283
296
  return;
284
297
  }
298
+ if (this.runtimeUnavailable) {
299
+ this.failReady(this.getRuntimeUnavailableError());
300
+ return;
301
+ }
285
302
  if (this.started) {
286
303
  return;
287
304
  }
@@ -301,7 +318,14 @@ class MiniProgramBridgeClient {
301
318
  try {
302
319
  this.postHandshake();
303
320
  this.handshakeRetryTimer = setInterval(() => {
304
- this.postHandshake();
321
+ try {
322
+ this.postHandshake();
323
+ }
324
+ catch (error) {
325
+ this.failReady(error instanceof HbMiniProgramSDKError
326
+ ? error
327
+ : createSDKError('HANDSHAKE_FAILED', '小程序沙盒握手发送失败', error));
328
+ }
305
329
  }, HANDSHAKE_RETRY_INTERVAL);
306
330
  }
307
331
  catch (error) {
@@ -344,7 +368,10 @@ class MiniProgramBridgeClient {
344
368
  }
345
369
  handleEvent(message) {
346
370
  const eventName = message.method;
347
- if (eventName === 'ready') {
371
+ if (eventName === 'unload') {
372
+ this.markRuntimeUnavailable();
373
+ }
374
+ else if (eventName === 'ready' && !this.runtimeUnavailable) {
348
375
  this.resolveReadyOnce();
349
376
  }
350
377
  this.eventBus.emit(eventName, message.payload);
@@ -397,6 +424,22 @@ class MiniProgramBridgeClient {
397
424
  this.handshakeRetryTimer = undefined;
398
425
  }
399
426
  }
427
+ markRuntimeUnavailable() {
428
+ if (this.runtimeUnavailable) {
429
+ return;
430
+ }
431
+ const error = this.getRuntimeUnavailableError();
432
+ this.runtimeUnavailable = true;
433
+ this.clearReadyTimers();
434
+ this.failReady(error);
435
+ this.rejectAllPending(error);
436
+ }
437
+ getRuntimeUnavailableError() {
438
+ if (!this.runtimeUnavailableError) {
439
+ this.runtimeUnavailableError = createSDKError('RUNTIME_UNAVAILABLE', '小程序运行时已卸载');
440
+ }
441
+ return this.runtimeUnavailableError;
442
+ }
400
443
  rejectAllPending(error) {
401
444
  this.pendingRequests.forEach(pending => {
402
445
  clearTimeout(pending.timer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heybox/hb-sdk",
3
- "version": "0.5.11",
3
+ "version": "0.5.12",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": {
@@ -116,9 +116,7 @@
116
116
  "build:templates": "node scripts/copy-cli-templates.cjs",
117
117
  "build:types": "tsc -p tsconfig.dts.json",
118
118
  "check:boundary": "node scripts/check-boundary.cjs",
119
- "check:docs-sync": "node scripts/check-docs-sync.cjs",
120
- "sync:agent-skills-payload": "node skill/scripts/sync-agent-skills-payload.mjs",
121
- "check:agent-skills-payload": "node skill/scripts/sync-agent-skills-payload.mjs --check",
119
+ "check:docs-sync": "pnpm -w exec hbexec hb-sdk check",
122
120
  "clean": "rimraf ./dist && rimraf ./types",
123
121
  "test:unit": "NODE_OPTIONS='--conditions=heybox' vitest run",
124
122
  "test:unit:coverage": "NODE_OPTIONS='--conditions=heybox' vitest run --coverage",
package/skill/SKILL.md CHANGED
@@ -118,6 +118,7 @@ For host/runtime/protocol-maintenance code:
118
118
  - `pnpm --filter @heybox/hb-sdk run check:boundary`
119
119
  - `pnpm --filter @heybox/hb-sdk run test:unit`
120
120
  - Verify `dist/cli.cjs` does not have any `require('cos-nodejs-sdk-v5')` left after `build:cli`; the boundary check enforces this automatically.
121
- 8. Verify public payload sync before publishing:
122
- - `pnpm --filter @heybox-spa/open run sync:agent-skills`
123
- - `pnpm --filter @heybox-spa/open run check:agent-skills`
121
+ 8. Verify the canonical payload before publishing:
122
+ - `pnpm exec hbexec hb-sdk sync`
123
+ - `pnpm exec hbexec hb-sdk check`
124
+ - For a release artifact, run `pnpm exec hbexec hb-sdk sync --out-dir <payload-dir>` and then `pnpm exec hbexec hb-sdk check-artifact --artifact-dir <payload-dir>`.
@@ -6,7 +6,7 @@
6
6
 
7
7
  - packages/hb-sdk/src/protocol.ts
8
8
  - packages/hb-sdk/README.md
9
- - apps/h5/docs/hb_sdk/src/.vuepress/public/llms/reference/README.md
9
+ - apps/docs/hb-sdk/reference/index.md
10
10
 
11
11
  ## Contents
12
12
 
@@ -197,16 +197,16 @@ export type {
197
197
 
198
198
  # Reference
199
199
 
200
- Reference 由 `packages/hb-sdk` 的公开导出与源码注释自动生成,不重复 Guide 的接入流程。
200
+ Reference 由 `@heybox/hb-sdk` 的公开导出与源码注释自动生成,不重复 Guide 的接入流程。
201
201
 
202
202
  | 导出面 | 说明 |
203
203
  | --- | --- |
204
- | [Root API](./root/README.md) | 来自 `src/index.ts` 的默认导出、命名导出与公开能力。 |
205
- | [Protocol API](./protocol/README.md) | 来自 `src/protocol.ts` 的协议常量、消息类型与 method 契约。 |
204
+ | [Root API](./root/) | 来自 `src/index.ts` 的默认导出、命名导出与公开能力。 |
205
+ | [Protocol API](./protocol/) | 来自 `src/protocol.ts` 的协议常量、消息类型与 method 契约。 |
206
206
 
207
207
  ## 查询建议
208
208
 
209
- - 想查业务接入路径:先看 [Guide](../guide/README.md)。
209
+ - 想查业务接入路径:先看 [Guide](../guide/)。
210
210
  - 想查导出符号:从 Root API 或 Protocol API 进入对应分类页。
211
211
  - 想看场景化用法:优先看 Guide / Recipes 页面中的“进一步阅读”。
212
212
 
@@ -214,5 +214,5 @@ Reference 由 `packages/hb-sdk` 的公开导出与源码注释自动生成,不
214
214
 
215
215
  | 导出面 | Classes | Functions | Interfaces | Types | Constants |
216
216
  | --- | ---: | ---: | ---: | ---: | ---: |
217
- | Root API | 3 | 4 | 53 | 45 | 3 |
218
- | Protocol API | 0 | 1 | 30 | 57 | 26 |
217
+ | Root API | 3 | 4 | 67 | 57 | 4 |
218
+ | Protocol API | 0 | 1 | 39 | 66 | 32 |
@@ -640,7 +640,7 @@ await network.request({
640
640
 
641
641
  ## 生命周期事件
642
642
 
643
- 使用 `on()` 监听父容器派发的小程序事件。`on()` 会返回取消监听函数,组件卸载或页面销毁时应及时调用。
643
+ SDK 实例创建后会自动开始与父容器握手。使用 `on()` 监听父容器派发的小程序事件时,默认单例会被懒创建并自动开始握手;`on()` 会返回取消监听函数,组件卸载或页面销毁时应及时调用。
644
644
 
645
645
  ```ts
646
646
  import { on } from '@heybox/hb-sdk';
@@ -10,7 +10,7 @@
10
10
  - packages/hb-sdk/src/cli/commands/dev.ts
11
11
  - packages/hb-sdk/src/cli/commands/login.ts
12
12
  - packages/hb-sdk/src/cli/templates/vue3-vite-ts/README.md.ejs
13
- - apps/h5/docs/hb_sdk/src/guide/cli.md
13
+ - apps/docs/hb-sdk/guide/cli.md
14
14
  - packages/hb-sdk/README.md
15
15
 
16
16
  ## Contents
@@ -348,12 +348,12 @@ Agent rules:
348
348
  pnpm --filter @heybox/hb-sdk run test:unit
349
349
  pnpm --filter @heybox/hb-sdk run build:package
350
350
  pnpm --filter @heybox/hb-sdk run check:boundary
351
- pnpm --filter @heybox/hb-sdk run check:docs-sync
351
+ pnpm exec hbexec hb-sdk check
352
352
  ```
353
353
 
354
354
  `check:boundary` 用于保护 SDK、CLI、mock host 与 runtime 之间的依赖边界。调整 CLI、mock 或协议导出时应一起运行。
355
355
 
356
- `check:docs-sync` 用于校验 `README`、文档站 llms 镜像、skill references 与公开 `agent-skills` payload 没有漏同步。维护清单见 `packages/hb-sdk/DOC_SYNC_CHECKLIST.md`。
356
+ `hbexec hb-sdk check` 只读校验 docs、skill references,并在临时目录生成与校验 `agent-skills` payload;不要求 canonical artifact 已存在,也不包含 changelog。维护清单见 `packages/hb-sdk/DOC_SYNC_CHECKLIST.md`。
357
357
 
358
358
  ## Generated template README
359
359
 
@@ -5,7 +5,8 @@
5
5
  ## Sources
6
6
 
7
7
  - packages/hb-sdk/README.md
8
- - apps/h5/docs/hb_sdk/src/.vuepress/public/llms/
8
+ - apps/docs/hb-sdk/guide/**
9
+ - apps/docs/hb-sdk/recipes/**
9
10
  ## Positive examples
10
11
 
11
12
  ### Minimal user info
@@ -4,42 +4,21 @@
4
4
 
5
5
  ## Sources
6
6
 
7
- - apps/h5/docs/hb_sdk/src/.vuepress/public/llms.txt
8
- - apps/h5/docs/hb_sdk/src/.vuepress/public/llms/
9
- ## Local generated docs entrypoint
7
+ - apps/docs/hb-sdk/guide/**
8
+ - apps/docs/hb-sdk/recipes/**
9
+ - apps/docs/hb-sdk/reference/**
10
+ - packages/hb-sdk/src/**
11
+ ## Offline references
10
12
 
11
- The docs site maintains `llms.txt` and markdown mirrors under `apps/h5/docs/hb_sdk/src/.vuepress/public/llms/`. Read `llms.txt` first for navigation, then the specific guide/reference/recipe markdown needed for the task.
13
+ The bundled references are generated directly from hand-maintained docs, generated API owner sources, and SDK/CLI sources. They do not depend on the docs site's `.vitepress/public/llms` mirrors.
12
14
 
13
- ```md
14
- # @heybox/hb-sdk
15
- > LLM-friendly index for the `@heybox/hb-sdk` documentation site. API Reference is auto-generated from public exports and source comments; Guide and Recipes are hand-maintained.
16
- This site documents the iframe-side SDK for external mini programs. For AI retrieval, fetch this index first, then follow the linked markdown mirrors under `./llms/`.
17
- ## Docs
18
- - [Documentation home](./llms/README.md): 第一次接入时,按下面顺序读:
19
- - [Guide index](./llms/guide/README.md): Guide 面向第一次接入 `@heybox/hb-sdk` 的开发者,目标是先跑通,再理解边界。
20
- - [Reference index](./llms/reference/README.md): Reference 由 `packages/hb-sdk` 的公开导出与源码注释自动生成,不重复 Guide 的接入流程。
21
- - [Recipes index](./llms/recipes/README.md): Recipes 放可以直接复制到业务里的场景写法。它比 Guide 更具体,比 Reference 更偏组合使用。
22
- - [LLM usage guide](./llms/guide/llms.md): 文档站会自动维护一份标准的 `llms.txt` 索引,以及一组给 AI 直接读取的 Markdown 镜像页,方便模型按文档树逐步抓取内容。
23
- ## API Reference
24
- - [Root API](./llms/reference/root/README.md): 该页面收录从 `src/index.ts` 公开导出的 API。
25
- - [Protocol API](./llms/reference/protocol/README.md): 该页面收录从 `src/protocol.ts` 公开导出的 API。
26
- - [Root functions](./llms/reference/root/functions/README.md)
27
- - [Root interfaces](./llms/reference/root/interfaces/README.md): `on/off` 会基于该映射推导 handler 参数类型。 |
28
- - [Protocol interfaces](./llms/reference/protocol/interfaces/README.md): 所有请求失败都会被规范化成该结构,SDK 侧再包装为 `HbMiniProgramSDKError`。 |
29
- - [Root types](./llms/reference/root/types/README.md): `navigation.close` 不需要入参。
30
- - [Protocol types](./llms/reference/protocol/types/README.md): `navigation.close` 不需要入参。
31
- ## Guides
32
- - [Agent Skill 安装](./llms/guide/agent-skill.md): `hb-sdk` Agent Skill 用来让 AI / Agent 按本仓库约定使用 `@heybox/hb-sdk` 和配套 `hb-sdk` CLI,包括 iframe 小程序接入、`ready`、用户信息、登录、事件、CLI 创建模板、`hb-sdk dev` 本地调试、CLI 登录态、协议边界和常见错误处理。
33
- - [用户与登录](./llms/guide/auth.md): 用户与授权模块当前分工:
34
- - [CLI 与本地 mock 调试](./llms/guide/cli.md): `@heybox/hb-sdk` 同时提供 iframe 内使用的 SDK 和配套 `hb-sdk` CLI。CLI 负责项目模板、本地 Vite 服务、浏览器 mock runtime host 和 CLI 自己的 Heybox 登录缓存;它不是 iframe SDK 登录态的替代品。
35
- - [错误处理](./llms/guide/error-handling.md): SDK 对外抛出的标准错误类型是 `HbMiniProgramSDKError`。
36
- - [安装与运行环境](./llms/guide/installation.md): 如果工坊小程序只是普通展示页面,不调用黑盒开放能力,也不监听 SDK 生命周期事件,可以不安装、不引用、不初始化 `@heybox/hb-sdk`。父容器仍可能在 URL 上注入 `hb_mini_bridge_nonce`,业务页可以直接忽略。
37
- - [事件与生命周期](./llms/guide/lifecycle.md): SDK 通过 `on` 监听父容器派发的小程序生命周期和业务事件。
38
- - [小程序工坊上架规则 v2(试行)](./llms/guide/mini-program-publishing-rules.md): 本规则用于说明小程序工坊的小程序发布、上架和持续在线要求。通过审核不等于获得推荐或公开展示;工坊广场、推荐位、搜索等流量分发规则另行制定。
39
- - [快速开始](./llms/guide/quick-start.md): 如果页面不需要黑盒开放能力,可以不接入 SDK。这是一条需要用户能力时的最短接入路径:等待 SDK 完成握手,然后读取当前用户登录态。
40
- ## Recipes
41
- - [独立 SDK 实例](./llms/recipes/custom-instance.md): 大多数业务页使用默认单例即可。只有在需要隔离上下文时,再创建独立实例。
42
- - [登录门禁](./llms/recipes/login-gate.md): 当业务动作必须登录后才能继续时,可以把登录态判断收敛成 `ensureLogin`。
43
- ## Optional
44
- - Full markdown mirrors for the docs site are available under `./llms/guide/`, `./llms/reference/`, and `./llms/recipes/`.
45
- ```
15
+ - Root SDK and Vite API: `references/api-root.md`
16
+ - Host/runtime protocol API: `references/api-protocol.md`
17
+ - CLI and local development: `references/cli.md`
18
+ - Common flows: `references/recipes.md`
19
+ - Security and capability limits: `references/safety-boundaries.md`
20
+ - Examples and evaluation: `references/examples.md`, `references/smoke-evaluation.md`
21
+
22
+ ## Online supplement
23
+
24
+ Online `llms.txt` and markdown mirrors are optional supplements, not prerequisites for offline Skill use. Their canonical public URL is not frozen: on 2026-07-10 `https://docs.xiaoheihe.cn/hb_sdk/llms.txt` returned 404 and the legacy URL fetch timed out. Do not claim either endpoint is available without a fresh successful response.
@@ -4,12 +4,12 @@
4
4
 
5
5
  ## Sources
6
6
 
7
- - apps/h5/docs/hb_sdk/src/.vuepress/public/llms/guide/quick-start.md
8
- - apps/h5/docs/hb_sdk/src/.vuepress/public/llms/guide/auth.md
9
- - apps/h5/docs/hb_sdk/src/.vuepress/public/llms/guide/lifecycle.md
10
- - apps/h5/docs/hb_sdk/src/.vuepress/public/llms/guide/error-handling.md
11
- - apps/h5/docs/hb_sdk/src/.vuepress/public/llms/recipes/login-gate.md
12
- - apps/h5/docs/hb_sdk/src/.vuepress/public/llms/recipes/custom-instance.md
7
+ - apps/docs/hb-sdk/guide/quick-start.md
8
+ - apps/docs/hb-sdk/guide/auth.md
9
+ - apps/docs/hb-sdk/guide/lifecycle.md
10
+ - apps/docs/hb-sdk/guide/error-handling.md
11
+ - apps/docs/hb-sdk/recipes/login-gate.md
12
+ - apps/docs/hb-sdk/recipes/custom-instance.md
13
13
 
14
14
  ## Contents
15
15
 
@@ -76,7 +76,7 @@ stopAuthChange()
76
76
 
77
77
  默认单例适合一个页面只有一个 SDK 上下文的情况。大多数小程序页面都应该使用默认单例,因为它可以避免重复握手和重复维护事件监听。
78
78
 
79
- 需要控制 `timeout`、注入测试 window 或隔离多个上下文时,再使用 [独立实例](../recipes/custom-instance.md)。
79
+ 需要控制 `timeout`、注入测试 window 或隔离多个上下文时,再使用 [独立实例](../recipes/custom-instance)。
80
80
 
81
81
  ## User and login
82
82
 
@@ -193,8 +193,8 @@ stop()
193
193
 
194
194
  完整载荷与事件名见:
195
195
 
196
- - [MiniProgramEventPayloadMap](../reference/protocol/interfaces/MiniProgramEventPayloadMap.md)
197
- - [MiniProgramEventName](../reference/protocol/types/README.md#miniprogrameventname)
196
+ - [MiniProgramEventPayloadMap](../reference/protocol/interfaces/MiniProgramEventPayloadMap)
197
+ - [MiniProgramEventName](../reference/protocol/types/#miniprogrameventname)
198
198
 
199
199
  ## 生命周期建议
200
200
 
@@ -5,12 +5,13 @@
5
5
  ## Sources
6
6
 
7
7
  - packages/hb-sdk/README.md
8
- - apps/h5/docs/hb_sdk/src/.vuepress/public/llms/guide/auth.md
8
+ - apps/docs/hb-sdk/guide/auth.md
9
9
  ## Required boundaries
10
10
 
11
11
  ## 能力边界
12
12
 
13
- - 调用模块能力前会自动等待 `ready()`,但业务仍建议在页面启动阶段显式 `await ready()`,便于集中处理握手失败。
13
+ - SDK 实例创建后会自动开始握手;默认单例仍按需懒创建,`ready()`、`on()` 或任意模块能力调用都会创建默认单例并开始握手。
14
+ - `ready()` 只等待已有握手结果,不主动触发新的握手;调用模块能力前会自动等待 `ready()`,但业务仍建议在页面启动阶段显式 `await ready()`,便于集中处理握手失败。
14
15
  - `user.getInfo()`、`user.getCurrentUserDetail()`、`user.getCurrentUserProfile()`、`user.getPlatformAccountOverview()`、`user.getPlatformAccountInfo(platform)` 和 `user.getSteamGameList(options)` 不会触发登录;登录必须由业务在用户操作后调用 `auth.login()`。
15
16
  - 当前用户详情和平台账号 API 只允许读取当前登录用户,不支持传入 `userid` 查询其他人,也不透传 `/account/home_v2/` 原始响应。
16
17
  - 分享、截图、UI、设备、导航、storage 和网络请求只开放稳定窄接口,不透传黑盒客户端内部协议参数。
@@ -177,16 +177,14 @@ const viteEntry = read('packages/hb-sdk/src/vite/index.ts');
177
177
  const cliEntry = read('packages/hb-sdk/src/cli/index.ts');
178
178
  const cliTemplateReadme = read('packages/hb-sdk/src/cli/templates/vue3-vite-ts/README.md.ejs');
179
179
  const readme = read('packages/hb-sdk/README.md');
180
- const cliGuide = frontmatterless(read('apps/h5/docs/hb_sdk/src/guide/cli.md'));
181
- const llmsTxt = read('apps/h5/docs/hb_sdk/src/.vuepress/public/llms.txt');
182
- const quickStart = frontmatterless(read('apps/h5/docs/hb_sdk/src/.vuepress/public/llms/guide/quick-start.md'));
183
- const authGuide = frontmatterless(read('apps/h5/docs/hb_sdk/src/.vuepress/public/llms/guide/auth.md'));
184
- const lifecycleGuide = frontmatterless(read('apps/h5/docs/hb_sdk/src/.vuepress/public/llms/guide/lifecycle.md'));
185
- const errorGuide = frontmatterless(read('apps/h5/docs/hb_sdk/src/.vuepress/public/llms/guide/error-handling.md'));
186
- const loginGate = frontmatterless(read('apps/h5/docs/hb_sdk/src/.vuepress/public/llms/recipes/login-gate.md'));
187
- const customInstance = frontmatterless(read('apps/h5/docs/hb_sdk/src/.vuepress/public/llms/recipes/custom-instance.md'));
188
- const referenceHome = frontmatterless(read('apps/h5/docs/hb_sdk/src/.vuepress/public/llms/reference/README.md'));
189
-
180
+ const cliGuide = frontmatterless(read('apps/docs/hb-sdk/guide/cli.md'));
181
+ const quickStart = frontmatterless(read('apps/docs/hb-sdk/guide/quick-start.md'));
182
+ const authGuide = frontmatterless(read('apps/docs/hb-sdk/guide/auth.md'));
183
+ const lifecycleGuide = frontmatterless(read('apps/docs/hb-sdk/guide/lifecycle.md'));
184
+ const errorGuide = frontmatterless(read('apps/docs/hb-sdk/guide/error-handling.md'));
185
+ const loginGate = frontmatterless(read('apps/docs/hb-sdk/recipes/login-gate.md'));
186
+ const customInstance = frontmatterless(read('apps/docs/hb-sdk/recipes/custom-instance.md'));
187
+ const referenceHome = frontmatterless(read('apps/docs/hb-sdk/reference/index.md'));
190
188
  const quickStartSection = extractSection(readme, '## 快速开始');
191
189
  const runtimeEnvironment = extractSection(readme, '## 运行环境');
192
190
  const publicCapabilities = extractSection(readme, '## 常用能力');
@@ -300,7 +298,7 @@ ${lifecycleEvents}
300
298
  files.set('api-protocol.md', `${header('Protocol API reference', [
301
299
  'packages/hb-sdk/src/protocol.ts',
302
300
  'packages/hb-sdk/README.md',
303
- 'apps/h5/docs/hb_sdk/src/.vuepress/public/llms/reference/README.md',
301
+ 'apps/docs/hb-sdk/reference/index.md',
304
302
  ])}${contents([
305
303
  ['Host/runtime-only warning', 'hostruntime-only-warning'],
306
304
  ['Public protocol entrypoint', 'public-protocol-entrypoint'],
@@ -330,7 +328,7 @@ files.set('cli.md', `${header('CLI reference', [
330
328
  'packages/hb-sdk/src/cli/commands/dev.ts',
331
329
  'packages/hb-sdk/src/cli/commands/login.ts',
332
330
  'packages/hb-sdk/src/cli/templates/vue3-vite-ts/README.md.ejs',
333
- 'apps/h5/docs/hb_sdk/src/guide/cli.md',
331
+ 'apps/docs/hb-sdk/guide/cli.md',
334
332
  'packages/hb-sdk/README.md',
335
333
  ])}${contents([
336
334
  ['When to use the CLI', 'when-to-use-the-cli'],
@@ -463,12 +461,12 @@ ${fenced('md', cliTemplateReadme)}
463
461
  `);
464
462
 
465
463
  files.set('recipes.md', `${header('Recipes', [
466
- 'apps/h5/docs/hb_sdk/src/.vuepress/public/llms/guide/quick-start.md',
467
- 'apps/h5/docs/hb_sdk/src/.vuepress/public/llms/guide/auth.md',
468
- 'apps/h5/docs/hb_sdk/src/.vuepress/public/llms/guide/lifecycle.md',
469
- 'apps/h5/docs/hb_sdk/src/.vuepress/public/llms/guide/error-handling.md',
470
- 'apps/h5/docs/hb_sdk/src/.vuepress/public/llms/recipes/login-gate.md',
471
- 'apps/h5/docs/hb_sdk/src/.vuepress/public/llms/recipes/custom-instance.md',
464
+ 'apps/docs/hb-sdk/guide/quick-start.md',
465
+ 'apps/docs/hb-sdk/guide/auth.md',
466
+ 'apps/docs/hb-sdk/guide/lifecycle.md',
467
+ 'apps/docs/hb-sdk/guide/error-handling.md',
468
+ 'apps/docs/hb-sdk/recipes/login-gate.md',
469
+ 'apps/docs/hb-sdk/recipes/custom-instance.md',
472
470
  ])}${contents([
473
471
  ['Quick start', 'quick-start'],
474
472
  ['User and login', 'user-and-login'],
@@ -503,7 +501,7 @@ ${customInstance}
503
501
 
504
502
  files.set('safety-boundaries.md', `${header('Safety boundaries', [
505
503
  'packages/hb-sdk/README.md',
506
- 'apps/h5/docs/hb_sdk/src/.vuepress/public/llms/guide/auth.md',
504
+ 'apps/docs/hb-sdk/guide/auth.md',
507
505
  ])}## Required boundaries
508
506
 
509
507
  ${capabilityBoundaries}
@@ -521,18 +519,30 @@ ${capabilityBoundaries}
521
519
  `);
522
520
 
523
521
  files.set('llms-index.md', `${header('LLM documentation index', [
524
- 'apps/h5/docs/hb_sdk/src/.vuepress/public/llms.txt',
525
- 'apps/h5/docs/hb_sdk/src/.vuepress/public/llms/',
526
- ])}## Local generated docs entrypoint
522
+ 'apps/docs/hb-sdk/guide/**',
523
+ 'apps/docs/hb-sdk/recipes/**',
524
+ 'apps/docs/hb-sdk/reference/**',
525
+ 'packages/hb-sdk/src/**',
526
+ ])}## Offline references
527
+
528
+ The bundled references are generated directly from hand-maintained docs, generated API owner sources, and SDK/CLI sources. They do not depend on the docs site's \`.vitepress/public/llms\` mirrors.
529
+
530
+ - Root SDK and Vite API: \`references/api-root.md\`
531
+ - Host/runtime protocol API: \`references/api-protocol.md\`
532
+ - CLI and local development: \`references/cli.md\`
533
+ - Common flows: \`references/recipes.md\`
534
+ - Security and capability limits: \`references/safety-boundaries.md\`
535
+ - Examples and evaluation: \`references/examples.md\`, \`references/smoke-evaluation.md\`
527
536
 
528
- The docs site maintains \`llms.txt\` and markdown mirrors under \`apps/h5/docs/hb_sdk/src/.vuepress/public/llms/\`. Read \`llms.txt\` first for navigation, then the specific guide/reference/recipe markdown needed for the task.
537
+ ## Online supplement
529
538
 
530
- ${fenced('md', llmsTxt)}
539
+ Online \`llms.txt\` and markdown mirrors are optional supplements, not prerequisites for offline Skill use. Their canonical public URL is not frozen: on 2026-07-10 \`https://docs.xiaoheihe.cn/hb_sdk/llms.txt\` returned 404 and the legacy URL fetch timed out. Do not claim either endpoint is available without a fresh successful response.
531
540
  `);
532
541
 
533
542
  files.set('examples.md', `${header('Smoke examples and anti-examples', [
534
543
  'packages/hb-sdk/README.md',
535
- 'apps/h5/docs/hb_sdk/src/.vuepress/public/llms/',
544
+ 'apps/docs/hb-sdk/guide/**',
545
+ 'apps/docs/hb-sdk/recipes/**',
536
546
  ])}## Positive examples
537
547
 
538
548
  ### Minimal user info
package/skill/skill.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "hb-sdk",
3
- "skillVersion": "0.5.11+skill.20c209340580",
3
+ "skillVersion": "0.5.11+skill.c0b2205c74df",
4
4
  "sdk": {
5
5
  "package": "@heybox/hb-sdk",
6
6
  "version": "0.5.11",
7
7
  "compatibility": "0.5.11"
8
8
  },
9
9
  "source": "https://open.xiaoheihe.cn/agent-skills/hb-sdk",
10
- "integrity": "sha256-20c209340580ee5507bb72eb8cd044693b29e109472e93fc3d8302a53b4770d2"
10
+ "integrity": "sha256-c0b2205c74df6a619a08d4f9a974d89a796d1783cc30a1d698d875bd179fd8c3"
11
11
  }
@@ -42,6 +42,8 @@ export declare class MiniProgramBridgeClient implements MiniProgramRequester {
42
42
  private readyTimer?;
43
43
  private handshakeRetryTimer?;
44
44
  private destroyed;
45
+ private runtimeUnavailable;
46
+ private runtimeUnavailableError?;
45
47
  constructor(options?: MiniProgramSDKOptions);
46
48
  /** 等待父容器握手完成。 */
47
49
  ready(): Promise<void>;
@@ -62,6 +64,8 @@ export declare class MiniProgramBridgeClient implements MiniProgramRequester {
62
64
  private resolveReadyOnce;
63
65
  private failReady;
64
66
  private clearReadyTimers;
67
+ private markRuntimeUnavailable;
68
+ private getRuntimeUnavailableError;
65
69
  private rejectAllPending;
66
70
  }
67
71
  export {};