@heybox/hb-sdk 0.9.1-alpha.10 → 0.9.1-alpha.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +2 -1
  3. package/dist/cli-chunks/{build-BK0MOduC.cjs → build-CDvX6mZ_.cjs} +5 -5
  4. package/dist/cli-chunks/{context-D7AFyc_9.cjs → context-ycfj98q4.cjs} +2 -2
  5. package/dist/cli-chunks/{create-C-pAXZR_.cjs → create-TQBnsU6A.cjs} +1 -1
  6. package/dist/cli-chunks/{dev-CONKtd6c.cjs → dev-DIlr0XsT.cjs} +8 -8
  7. package/dist/cli-chunks/{doctor-D18leeH7.cjs → doctor-CNvx5BMQ.cjs} +1 -1
  8. package/dist/cli-chunks/{index-BWRDIX1T.cjs → index-B7zxtWTI.cjs} +16 -16
  9. package/dist/cli-chunks/{index-DJoBhXcG.cjs → index-CPAecgVy.cjs} +1 -1
  10. package/dist/cli-chunks/{index.esm-CtAKePcf.cjs → index.esm-CshHset7.cjs} +6 -6
  11. package/dist/cli-chunks/{login-BHq8vDRt.cjs → login-D9IsRXmh.cjs} +1 -1
  12. package/dist/cli-chunks/{project-vite-DD3bmbqm.cjs → project-vite-B4bIN6iT.cjs} +1 -1
  13. package/dist/cli-chunks/{remote-DeLLzkXt.cjs → remote-DeUMkvWX.cjs} +6 -6
  14. package/dist/cli-chunks/{runtime-gate-wKj1l5xM.cjs → runtime-gate-C8LOiCNj.cjs} +2 -2
  15. package/dist/cli-chunks/{runtime-permission-env-DBra_0-U.cjs → runtime-permission-env-DJh53zIV.cjs} +29 -2
  16. package/dist/cli-chunks/{skill-Cq3wjRBj.cjs → skill-5dzzu2QT.cjs} +2 -2
  17. package/dist/cli-chunks/{version-BF4JQQCU.cjs → version-DJMVnGTf.cjs} +1 -1
  18. package/dist/cli.cjs +1 -1
  19. package/dist/devtools/browser-dev-host/assets/browser-dev-host-WX0SWy37.js +102 -0
  20. package/dist/devtools/browser-dev-host/assets/{desktop-app-launch-DXmUwcoE.js → desktop-app-launch-F0wNWGvm.js} +1 -1
  21. package/dist/devtools/browser-dev-host/assets/{index-CVZ3CdPt.js → index-BdfQ_aP4.js} +3 -3
  22. package/dist/devtools/browser-dev-host/index.html +2 -2
  23. package/dist/index.cjs.js +7 -1
  24. package/dist/index.esm.js +7 -1
  25. package/dist/miniapp-publish.cjs.js +27 -0
  26. package/dist/miniapp-publish.esm.js +27 -0
  27. package/dist/vite.cjs.js +36 -1
  28. package/dist/vite.esm.js +36 -1
  29. package/package.json +6 -6
  30. package/skill/SKILL.md +10 -0
  31. package/skill/skill.json +5 -5
  32. package/types/index.d.ts +7 -2
  33. package/types/miniapp-publish/index.d.ts +3 -0
  34. package/types/vite/index.d.ts +1 -0
  35. package/dist/devtools/browser-dev-host/assets/browser-dev-host-C4b9nlYA.js +0 -102
@@ -5,8 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <meta name="theme-color" content="#f4f5f7" />
7
7
  <title>小程序工坊调试台</title>
8
- <script type="module" crossorigin src="/assets/index-CVZ3CdPt.js"></script>
9
- <link rel="modulepreload" crossorigin href="/assets/desktop-app-launch-DXmUwcoE.js">
8
+ <script type="module" crossorigin src="/assets/index-BdfQ_aP4.js"></script>
9
+ <link rel="modulepreload" crossorigin href="/assets/desktop-app-launch-F0wNWGvm.js">
10
10
  <link rel="stylesheet" crossorigin href="/assets/index-BRxbUJVN.css">
11
11
  </head>
12
12
  <body>
package/dist/index.cjs.js CHANGED
@@ -7278,7 +7278,7 @@ function createMessageId() {
7278
7278
  /** 构建时替换为当前发布包的实际版本。 */
7279
7279
  const HB_SDK_VERSION = typeof undefined === 'string'
7280
7280
  ? undefined
7281
- : '0.9.1-alpha.10';
7281
+ : '0.9.1-alpha.12';
7282
7282
 
7283
7283
  const RUNTIME_MODES = new Set(['production', 'preview', 'development', 'unknown']);
7284
7284
  const OPERATING_SYSTEM_NAMES = new Set(['android', 'ios', 'ohos', 'windows', 'macos', 'linux', 'unknown']);
@@ -10270,6 +10270,12 @@ function decodeBase64Url(value) {
10270
10270
  * @see {@link MiniProgramScreenshotOptions}
10271
10271
  */
10272
10272
  function screenshot(requester, options) {
10273
+ try {
10274
+ console.warn('[hb-sdk] share.screenshot 行为变更提醒:正式版 SDK 0.9.1 及以上默认添加小程序品牌水印;低于 0.9.1(含预发布版本)的 SDK 保持无水印截图。升级前请在目标截图区域底部预留至少 57 个逻辑像素,避免遮挡重要内容;watermarkTheme 的 light 为黑色水印,dark 为白色水印且是默认值,不自动跟随系统主题。系统按键截图不在此能力范围内。');
10275
+ }
10276
+ catch {
10277
+ // 日志输出失败不能阻断截图调用。
10278
+ }
10273
10279
  return requester.request(SHARE_SCREENSHOT_METHOD, options);
10274
10280
  }
10275
10281
 
package/dist/index.esm.js CHANGED
@@ -7274,7 +7274,7 @@ function createMessageId() {
7274
7274
  /** 构建时替换为当前发布包的实际版本。 */
7275
7275
  const HB_SDK_VERSION = typeof undefined === 'string'
7276
7276
  ? undefined
7277
- : '0.9.1-alpha.10';
7277
+ : '0.9.1-alpha.12';
7278
7278
 
7279
7279
  const RUNTIME_MODES = new Set(['production', 'preview', 'development', 'unknown']);
7280
7280
  const OPERATING_SYSTEM_NAMES = new Set(['android', 'ios', 'ohos', 'windows', 'macos', 'linux', 'unknown']);
@@ -10266,6 +10266,12 @@ function decodeBase64Url(value) {
10266
10266
  * @see {@link MiniProgramScreenshotOptions}
10267
10267
  */
10268
10268
  function screenshot(requester, options) {
10269
+ try {
10270
+ console.warn('[hb-sdk] share.screenshot 行为变更提醒:正式版 SDK 0.9.1 及以上默认添加小程序品牌水印;低于 0.9.1(含预发布版本)的 SDK 保持无水印截图。升级前请在目标截图区域底部预留至少 57 个逻辑像素,避免遮挡重要内容;watermarkTheme 的 light 为黑色水印,dark 为白色水印且是默认值,不自动跟随系统主题。系统按键截图不在此能力范围内。');
10271
+ }
10272
+ catch {
10273
+ // 日志输出失败不能阻断截图调用。
10274
+ }
10269
10275
  return requester.request(SHARE_SCREENSHOT_METHOD, options);
10270
10276
  }
10271
10277
 
@@ -9531,6 +9531,31 @@ function parseMiniappBindAppIds(value, options = {}) {
9531
9531
  return Object.freeze(appIds);
9532
9532
  }
9533
9533
 
9534
+ /** 小程序简介最大长度(Unicode code point),与服务端截断口径一致。 */
9535
+ const MINIAPP_DESC_MAX_LENGTH = 200;
9536
+ /**
9537
+ * 校验并规范化 `package.json#heybox.desc` / `manifest.desc`。
9538
+ *
9539
+ * @param value - 原始声明;未声明时为 `undefined`。
9540
+ * @param sourceLabel - 错误消息中的字段来源,默认 `package.json#heybox.desc`。
9541
+ * @returns 去除首尾空白后的简介;未声明或为空串时返回 `undefined`。
9542
+ * @throws `Error` 非字符串、超过 200 个字符,或包含除换行外的控制字符时抛出。
9543
+ */
9544
+ function parseMiniappDesc(value, sourceLabel = 'package.json#heybox.desc') {
9545
+ if (value === undefined)
9546
+ return undefined;
9547
+ if (typeof value !== 'string')
9548
+ throw new Error(`${sourceLabel} 必须是字符串`);
9549
+ const desc = value.replace(/^\p{White_Space}+|\p{White_Space}+$/gu, '');
9550
+ if (!desc)
9551
+ return undefined;
9552
+ if (Array.from(desc).length > MINIAPP_DESC_MAX_LENGTH)
9553
+ throw new Error(`${sourceLabel} 不能超过 ${MINIAPP_DESC_MAX_LENGTH} 个字符`);
9554
+ if (/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(desc.replace(/\n/g, '')))
9555
+ throw new Error(`${sourceLabel} 不能包含控制字符`);
9556
+ return desc;
9557
+ }
9558
+
9534
9559
  const MINIAPP_PERMISSION_KEYS = MINI_PROGRAM_PERMISSION_KEYS;
9535
9560
  function parseMiniappPermissions(value, options) {
9536
9561
  const sourceLabel = options.sourceLabel ?? 'package.json#heybox.permissions';
@@ -9703,6 +9728,7 @@ function validateMiniappManifestForDeploy(manifest) {
9703
9728
  throw new Error('manifest.category 缺失,请在 package.json#heybox.category 声明 tool、game 或 other 后重新构建');
9704
9729
  }
9705
9730
  const bindAppIds = parseMiniappBindAppIds(manifest.bindAppIds, { sourceLabel: 'manifest.bindAppIds' });
9731
+ const desc = parseMiniappDesc(manifest.desc, 'manifest.desc');
9706
9732
  return {
9707
9733
  version,
9708
9734
  sdkVersion,
@@ -9714,6 +9740,7 @@ function validateMiniappManifestForDeploy(manifest) {
9714
9740
  ...(window === undefined ? {} : { window }),
9715
9741
  ...(bindAppIds.length === 0 ? {} : { bindAppIds }),
9716
9742
  ...(category === undefined ? {} : { category }),
9743
+ ...(desc === undefined ? {} : { desc }),
9717
9744
  };
9718
9745
  }
9719
9746
  function validateGeneratedCompanions(value) {
@@ -9529,6 +9529,31 @@ function parseMiniappBindAppIds(value, options = {}) {
9529
9529
  return Object.freeze(appIds);
9530
9530
  }
9531
9531
 
9532
+ /** 小程序简介最大长度(Unicode code point),与服务端截断口径一致。 */
9533
+ const MINIAPP_DESC_MAX_LENGTH = 200;
9534
+ /**
9535
+ * 校验并规范化 `package.json#heybox.desc` / `manifest.desc`。
9536
+ *
9537
+ * @param value - 原始声明;未声明时为 `undefined`。
9538
+ * @param sourceLabel - 错误消息中的字段来源,默认 `package.json#heybox.desc`。
9539
+ * @returns 去除首尾空白后的简介;未声明或为空串时返回 `undefined`。
9540
+ * @throws `Error` 非字符串、超过 200 个字符,或包含除换行外的控制字符时抛出。
9541
+ */
9542
+ function parseMiniappDesc(value, sourceLabel = 'package.json#heybox.desc') {
9543
+ if (value === undefined)
9544
+ return undefined;
9545
+ if (typeof value !== 'string')
9546
+ throw new Error(`${sourceLabel} 必须是字符串`);
9547
+ const desc = value.replace(/^\p{White_Space}+|\p{White_Space}+$/gu, '');
9548
+ if (!desc)
9549
+ return undefined;
9550
+ if (Array.from(desc).length > MINIAPP_DESC_MAX_LENGTH)
9551
+ throw new Error(`${sourceLabel} 不能超过 ${MINIAPP_DESC_MAX_LENGTH} 个字符`);
9552
+ if (/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(desc.replace(/\n/g, '')))
9553
+ throw new Error(`${sourceLabel} 不能包含控制字符`);
9554
+ return desc;
9555
+ }
9556
+
9532
9557
  const MINIAPP_PERMISSION_KEYS = MINI_PROGRAM_PERMISSION_KEYS;
9533
9558
  function parseMiniappPermissions(value, options) {
9534
9559
  const sourceLabel = options.sourceLabel ?? 'package.json#heybox.permissions';
@@ -9701,6 +9726,7 @@ function validateMiniappManifestForDeploy(manifest) {
9701
9726
  throw new Error('manifest.category 缺失,请在 package.json#heybox.category 声明 tool、game 或 other 后重新构建');
9702
9727
  }
9703
9728
  const bindAppIds = parseMiniappBindAppIds(manifest.bindAppIds, { sourceLabel: 'manifest.bindAppIds' });
9729
+ const desc = parseMiniappDesc(manifest.desc, 'manifest.desc');
9704
9730
  return {
9705
9731
  version,
9706
9732
  sdkVersion,
@@ -9712,6 +9738,7 @@ function validateMiniappManifestForDeploy(manifest) {
9712
9738
  ...(window === undefined ? {} : { window }),
9713
9739
  ...(bindAppIds.length === 0 ? {} : { bindAppIds }),
9714
9740
  ...(category === undefined ? {} : { category }),
9741
+ ...(desc === undefined ? {} : { desc }),
9715
9742
  };
9716
9743
  }
9717
9744
  function validateGeneratedCompanions(value) {
package/dist/vite.cjs.js CHANGED
@@ -10282,7 +10282,7 @@ async function ensureBasicInfoDirectory(rootPath, relative) {
10282
10282
  /** 构建时替换为当前发布包的实际版本。 */
10283
10283
  const HB_SDK_VERSION = typeof undefined === 'string'
10284
10284
  ? undefined
10285
- : '0.9.1-alpha.10';
10285
+ : '0.9.1-alpha.12';
10286
10286
 
10287
10287
  /**
10288
10288
  * iframe 与调试台页面的开发期 console 捕获转发。
@@ -10700,6 +10700,31 @@ function parseMiniappCategory(value, sourceLabel = 'package.json#heybox.category
10700
10700
  throw new Error(`${sourceLabel} 必须是 tool、game 或 other`);
10701
10701
  }
10702
10702
 
10703
+ /** 小程序简介最大长度(Unicode code point),与服务端截断口径一致。 */
10704
+ const MINIAPP_DESC_MAX_LENGTH = 200;
10705
+ /**
10706
+ * 校验并规范化 `package.json#heybox.desc` / `manifest.desc`。
10707
+ *
10708
+ * @param value - 原始声明;未声明时为 `undefined`。
10709
+ * @param sourceLabel - 错误消息中的字段来源,默认 `package.json#heybox.desc`。
10710
+ * @returns 去除首尾空白后的简介;未声明或为空串时返回 `undefined`。
10711
+ * @throws `Error` 非字符串、超过 200 个字符,或包含除换行外的控制字符时抛出。
10712
+ */
10713
+ function parseMiniappDesc(value, sourceLabel = 'package.json#heybox.desc') {
10714
+ if (value === undefined)
10715
+ return undefined;
10716
+ if (typeof value !== 'string')
10717
+ throw new Error(`${sourceLabel} 必须是字符串`);
10718
+ const desc = value.replace(/^\p{White_Space}+|\p{White_Space}+$/gu, '');
10719
+ if (!desc)
10720
+ return undefined;
10721
+ if (Array.from(desc).length > MINIAPP_DESC_MAX_LENGTH)
10722
+ throw new Error(`${sourceLabel} 不能超过 ${MINIAPP_DESC_MAX_LENGTH} 个字符`);
10723
+ if (/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(desc.replace(/\n/g, '')))
10724
+ throw new Error(`${sourceLabel} 不能包含控制字符`);
10725
+ return desc;
10726
+ }
10727
+
10703
10728
  const MINIAPP_PERMISSION_KEYS = MINI_PROGRAM_PERMISSION_KEYS;
10704
10729
  function parseMiniappPermissions(value, options) {
10705
10730
  const sourceLabel = options.sourceLabel ?? 'package.json#heybox.permissions';
@@ -10811,6 +10836,7 @@ function renderMiniappManifest(manifest) {
10811
10836
  const window = validateMiniappWindow(manifest.window, 'manifest.window');
10812
10837
  const category = parseMiniappCategory(manifest.category, 'manifest.category');
10813
10838
  const bindAppIds = parseMiniappBindAppIds(manifest.bindAppIds, { sourceLabel: 'manifest.bindAppIds' });
10839
+ const desc = parseMiniappDesc(manifest.desc, 'manifest.desc');
10814
10840
  const output = {
10815
10841
  version: manifest.version,
10816
10842
  sdkVersion: manifest.sdkVersion,
@@ -10822,6 +10848,7 @@ function renderMiniappManifest(manifest) {
10822
10848
  ...(window === undefined ? {} : { window }),
10823
10849
  ...(bindAppIds.length === 0 ? {} : { bindAppIds }),
10824
10850
  ...(category === undefined ? {} : { category }),
10851
+ ...(desc === undefined ? {} : { desc }),
10825
10852
  };
10826
10853
  return `${JSON.stringify(output, null, 2)}\n`;
10827
10854
  }
@@ -10992,6 +11019,11 @@ function readMiniappCategoryFromPackageJson(root) {
10992
11019
  const { packageJson } = readMiniappPackageJson(root, false);
10993
11020
  return parseMiniappCategory(readMiniappHeyboxConfig(packageJson)?.category);
10994
11021
  }
11022
+ /** 读取并校验 `package.json#heybox.desc`;未声明或为空时返回 `undefined`。 */
11023
+ function readMiniappDescFromPackageJson(root) {
11024
+ const { packageJson } = readMiniappPackageJson(root, false);
11025
+ return parseMiniappDesc(readMiniappHeyboxConfig(packageJson)?.desc);
11026
+ }
10995
11027
  function readMiniappPackageJson(root, requireVersion) {
10996
11028
  const packageJsonPath = findNearestPackageJsonPath(root);
10997
11029
  let content;
@@ -20529,6 +20561,7 @@ const devSnapshotStores = devSnapshotRegistry[devSnapshotStoreKey];
20529
20561
  * 图片源路径相对项目目录;icon 为 200×200,封面 1–5 张,每张不超过 10 MiB / 4000 万像素。
20530
20562
  * build 会复制图片到输出目录 `_hb/basic-info/`,并将 Manifest 路径改为生成路径,不改写源图片;
20531
20563
  * - `heybox.category`:`tool`、`game` 或 `other`;构建时允许缺省,发布预检要求提供;
20564
+ * - `heybox.desc`:可选简介,最多 200 个字符,写入 manifest 后在小程序简介页展示;
20532
20565
  * - `heybox.platforms`:项目实际承诺适配的非空、无重复平台 allowlist;输出按平台词表规范排序。
20533
20566
  * 声明仍停留在旧模板移动端默认(`android`、`ios`、`ohos`)时,`serve` 与 `build` 都只输出
20534
20567
  * 一条非阻断提示,不影响构建结果;
@@ -20983,6 +21016,7 @@ function miniappManifest() {
20983
21016
  const companionDeclarations = includeCompanions ? companionConfig.declarations : undefined;
20984
21017
  const bindAppIds = readMiniappBindAppIdsFromPackageJson(root);
20985
21018
  const category = readMiniappCategoryFromPackageJson(root);
21019
+ const desc = readMiniappDescFromPackageJson(root);
20986
21020
  if (companionDeclarations && !parsedPermissions.permissions?.companion) {
20987
21021
  throw new Error('配置 companions 时必须声明 package.json#heybox.permissions.companion.enabled=true');
20988
21022
  }
@@ -21020,6 +21054,7 @@ function miniappManifest() {
21020
21054
  const companions = prepareMiniappCompanions(companionDeclarations, { root: companionConfig.projectRoot, outputRoot, platforms });
21021
21055
  node_fs.mkdirSync(path.dirname(manifestPath), { recursive: true });
21022
21056
  const manifestText = renderMiniappManifest({
21057
+ ...(desc === undefined ? {} : { desc }),
21023
21058
  version,
21024
21059
  sdkVersion,
21025
21060
  platforms,
package/dist/vite.esm.js CHANGED
@@ -10279,7 +10279,7 @@ async function ensureBasicInfoDirectory(rootPath, relative) {
10279
10279
  /** 构建时替换为当前发布包的实际版本。 */
10280
10280
  const HB_SDK_VERSION = typeof undefined === 'string'
10281
10281
  ? undefined
10282
- : '0.9.1-alpha.10';
10282
+ : '0.9.1-alpha.12';
10283
10283
 
10284
10284
  /**
10285
10285
  * iframe 与调试台页面的开发期 console 捕获转发。
@@ -10697,6 +10697,31 @@ function parseMiniappCategory(value, sourceLabel = 'package.json#heybox.category
10697
10697
  throw new Error(`${sourceLabel} 必须是 tool、game 或 other`);
10698
10698
  }
10699
10699
 
10700
+ /** 小程序简介最大长度(Unicode code point),与服务端截断口径一致。 */
10701
+ const MINIAPP_DESC_MAX_LENGTH = 200;
10702
+ /**
10703
+ * 校验并规范化 `package.json#heybox.desc` / `manifest.desc`。
10704
+ *
10705
+ * @param value - 原始声明;未声明时为 `undefined`。
10706
+ * @param sourceLabel - 错误消息中的字段来源,默认 `package.json#heybox.desc`。
10707
+ * @returns 去除首尾空白后的简介;未声明或为空串时返回 `undefined`。
10708
+ * @throws `Error` 非字符串、超过 200 个字符,或包含除换行外的控制字符时抛出。
10709
+ */
10710
+ function parseMiniappDesc(value, sourceLabel = 'package.json#heybox.desc') {
10711
+ if (value === undefined)
10712
+ return undefined;
10713
+ if (typeof value !== 'string')
10714
+ throw new Error(`${sourceLabel} 必须是字符串`);
10715
+ const desc = value.replace(/^\p{White_Space}+|\p{White_Space}+$/gu, '');
10716
+ if (!desc)
10717
+ return undefined;
10718
+ if (Array.from(desc).length > MINIAPP_DESC_MAX_LENGTH)
10719
+ throw new Error(`${sourceLabel} 不能超过 ${MINIAPP_DESC_MAX_LENGTH} 个字符`);
10720
+ if (/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(desc.replace(/\n/g, '')))
10721
+ throw new Error(`${sourceLabel} 不能包含控制字符`);
10722
+ return desc;
10723
+ }
10724
+
10700
10725
  const MINIAPP_PERMISSION_KEYS = MINI_PROGRAM_PERMISSION_KEYS;
10701
10726
  function parseMiniappPermissions(value, options) {
10702
10727
  const sourceLabel = options.sourceLabel ?? 'package.json#heybox.permissions';
@@ -10808,6 +10833,7 @@ function renderMiniappManifest(manifest) {
10808
10833
  const window = validateMiniappWindow(manifest.window, 'manifest.window');
10809
10834
  const category = parseMiniappCategory(manifest.category, 'manifest.category');
10810
10835
  const bindAppIds = parseMiniappBindAppIds(manifest.bindAppIds, { sourceLabel: 'manifest.bindAppIds' });
10836
+ const desc = parseMiniappDesc(manifest.desc, 'manifest.desc');
10811
10837
  const output = {
10812
10838
  version: manifest.version,
10813
10839
  sdkVersion: manifest.sdkVersion,
@@ -10819,6 +10845,7 @@ function renderMiniappManifest(manifest) {
10819
10845
  ...(window === undefined ? {} : { window }),
10820
10846
  ...(bindAppIds.length === 0 ? {} : { bindAppIds }),
10821
10847
  ...(category === undefined ? {} : { category }),
10848
+ ...(desc === undefined ? {} : { desc }),
10822
10849
  };
10823
10850
  return `${JSON.stringify(output, null, 2)}\n`;
10824
10851
  }
@@ -10989,6 +11016,11 @@ function readMiniappCategoryFromPackageJson(root) {
10989
11016
  const { packageJson } = readMiniappPackageJson(root, false);
10990
11017
  return parseMiniappCategory(readMiniappHeyboxConfig(packageJson)?.category);
10991
11018
  }
11019
+ /** 读取并校验 `package.json#heybox.desc`;未声明或为空时返回 `undefined`。 */
11020
+ function readMiniappDescFromPackageJson(root) {
11021
+ const { packageJson } = readMiniappPackageJson(root, false);
11022
+ return parseMiniappDesc(readMiniappHeyboxConfig(packageJson)?.desc);
11023
+ }
10992
11024
  function readMiniappPackageJson(root, requireVersion) {
10993
11025
  const packageJsonPath = findNearestPackageJsonPath(root);
10994
11026
  let content;
@@ -20526,6 +20558,7 @@ const devSnapshotStores = devSnapshotRegistry[devSnapshotStoreKey];
20526
20558
  * 图片源路径相对项目目录;icon 为 200×200,封面 1–5 张,每张不超过 10 MiB / 4000 万像素。
20527
20559
  * build 会复制图片到输出目录 `_hb/basic-info/`,并将 Manifest 路径改为生成路径,不改写源图片;
20528
20560
  * - `heybox.category`:`tool`、`game` 或 `other`;构建时允许缺省,发布预检要求提供;
20561
+ * - `heybox.desc`:可选简介,最多 200 个字符,写入 manifest 后在小程序简介页展示;
20529
20562
  * - `heybox.platforms`:项目实际承诺适配的非空、无重复平台 allowlist;输出按平台词表规范排序。
20530
20563
  * 声明仍停留在旧模板移动端默认(`android`、`ios`、`ohos`)时,`serve` 与 `build` 都只输出
20531
20564
  * 一条非阻断提示,不影响构建结果;
@@ -20980,6 +21013,7 @@ function miniappManifest() {
20980
21013
  const companionDeclarations = includeCompanions ? companionConfig.declarations : undefined;
20981
21014
  const bindAppIds = readMiniappBindAppIdsFromPackageJson(root);
20982
21015
  const category = readMiniappCategoryFromPackageJson(root);
21016
+ const desc = readMiniappDescFromPackageJson(root);
20983
21017
  if (companionDeclarations && !parsedPermissions.permissions?.companion) {
20984
21018
  throw new Error('配置 companions 时必须声明 package.json#heybox.permissions.companion.enabled=true');
20985
21019
  }
@@ -21017,6 +21051,7 @@ function miniappManifest() {
21017
21051
  const companions = prepareMiniappCompanions(companionDeclarations, { root: companionConfig.projectRoot, outputRoot, platforms });
21018
21052
  mkdirSync(path.dirname(manifestPath), { recursive: true });
21019
21053
  const manifestText = renderMiniappManifest({
21054
+ ...(desc === undefined ? {} : { desc }),
21020
21055
  version,
21021
21056
  sdkVersion,
21022
21057
  platforms,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heybox/hb-sdk",
3
- "version": "0.9.1-alpha.10",
3
+ "version": "0.9.1-alpha.12",
4
4
  "sideEffects": [
5
5
  "./src/index.ts",
6
6
  "./src/core/singleton.ts",
@@ -76,7 +76,7 @@
76
76
  "undici": "^7.28.0",
77
77
  "ws": "^8.18.0",
78
78
  "sharp": "^0.34.5",
79
- "@heybox/hb-sdk-protocol": "0.9.1-alpha.10"
79
+ "@heybox/hb-sdk-protocol": "0.9.1-alpha.12"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "vite": ">=5"
@@ -130,11 +130,11 @@
130
130
  "rollup-plugin-dts": "6.4.0",
131
131
  "@heybox-domain/heybox-theme": "~0.1.0",
132
132
  "@heybox-domain/heybox-vue3-ui": "~0.1.0",
133
- "@heybox/hb-api": "~1.28.14",
133
+ "@heybox/hb-sdk-runtime": "~0.9.1-alpha.12",
134
134
  "@heybox/runtime": "~0.2.1",
135
- "@heybox/hb-sdk-runtime": "~0.9.1-alpha.10",
136
- "@heybox/runtime-transport-fetch": "~0.2.1",
137
- "@heybox/runtime-policy": "~0.2.1"
135
+ "@heybox/runtime-policy": "~0.2.1",
136
+ "@heybox/hb-api": "~1.28.14",
137
+ "@heybox/runtime-transport-fetch": "~0.2.1"
138
138
  },
139
139
  "publishConfig": {
140
140
  "registry": "https://registry.npmjs.org/",
package/skill/SKILL.md CHANGED
@@ -7,6 +7,16 @@ description: Uses @heybox/hb-sdk and the hb-sdk CLI to build, debug, review, and
7
7
 
8
8
  Use this Skill for workshop mini-program application code, project declarations, public SDK APIs, CLI workflows, Host/Runtime protocol maintenance, and publishing review.
9
9
 
10
+ ## Screenshot API Changes: Mandatory Upgrade Checks
11
+
12
+ Before implementing screenshot flows or upgrading the SDK, use the canonical documentation index to read the screenshot Reference, community-sharing Recipe, and upgrade notes. Explicitly explain these changes to the developer:
13
+
14
+ - Check the installed SDK against the watermark version cutoff, including prerelease ordering. Explain the warning emitted by the SDK screenshot entry and the Runtime's compatibility behavior for legacy screenshots versus the default watermark behavior for newer SDKs.
15
+ - Check the required reserved area at the bottom of the capture region, the content that must remain unobstructed, and the corresponding rules for custom capture rectangles.
16
+ - Check the light/dark theme option, default colors, system-theme behavior, and the support boundary between SDK screenshots and physical-button screenshots.
17
+
18
+ Before upgrading, verify both the page layout and the captured image. Do not only update the dependency or invocation without explaining screenshot behavior changes. Read exact version cutoffs, dimensions, parameters, and Host support from the canonical documentation fetched for this task; never substitute an older installed Skill snapshot.
19
+
10
20
  ## Canonical Documentation
11
21
 
12
22
  The only maintained hb-sdk guidance source is:
package/skill/skill.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "hb-sdk",
3
- "skillVersion": "0.9.1-alpha.10+skill.3260e7d71ada",
3
+ "skillVersion": "0.9.1-alpha.12+skill.c3a240ca503a",
4
4
  "sdk": {
5
5
  "package": "@heybox/hb-sdk",
6
- "version": "0.9.1-alpha.10",
7
- "compatibility": "0.9.1-alpha.10"
6
+ "version": "0.9.1-alpha.12",
7
+ "compatibility": "0.9.1-alpha.12"
8
8
  },
9
9
  "distribution": {
10
10
  "type": "npm",
11
11
  "package": "@heybox/hb-sdk",
12
- "version": "0.9.1-alpha.10",
12
+ "version": "0.9.1-alpha.12",
13
13
  "path": "skill"
14
14
  },
15
- "integrity": "sha256-3260e7d71ada646d5d8b269490e3de4b5ecd3fe824b18cdb73fe64247738ffea"
15
+ "integrity": "sha256-c3a240ca503a1e5f3b15033e091f1fa79a8b70585aa0d8d8fa0b332daec60ac5"
16
16
  }
package/types/index.d.ts CHANGED
@@ -3451,7 +3451,12 @@ interface MiniProgramShareModule {
3451
3451
  * `pixelRatio` 换算,也不把越界矩形夹取到窗口内。JavaScript 的 coercible 非 number 值可能被
3452
3452
  * 当前 Runtime 接受,但这不是 TypeScript 公共合同,不应依赖。
3453
3453
  *
3454
- * Runtime 会在截图区域底部居中叠加「小黑盒 + 搜索图标 + 当前小程序名称」胶囊,
3454
+ * SDK 每次调用都会输出 warning,提醒水印行为变化及布局、配色要求;日志失败不阻断截图。
3455
+ * 新 Runtime 按 Version record 中已校验的 SDK 版本启用水印:低于正式版 `0.9.1`
3456
+ * (包括 `0.9.1-alpha.*`)或兼容模式下版本缺失时,静默保持无水印截图;
3457
+ * `0.9.1` 及以上默认添加水印。升级 SDK 前应同步调整截图布局。
3458
+ *
3459
+ * 启用水印时,Runtime 会在截图区域底部居中叠加「小黑盒 + 搜索图标 + 当前小程序名称」胶囊,
3455
3460
  * 下方显示灰色「小黑盒工坊小程序」。开发者应在目标截图区域底部预留至少 57 个逻辑
3456
3461
  * 像素的空白背景,不放置成绩、正文、按钮等重要内容,并保证背景与所选水印配色
3457
3462
  * 有足够对比度;自定义 `rect` 也按该区域的底部预留。水印不增加图片尺寸,只在本次
@@ -6261,7 +6266,7 @@ interface MiniProgramStorageModule {
6261
6266
  * @throws {@link HbMiniProgramSDKError} `INVALID_PARAMS`:`options`、key 或 JSON 数据非法,
6262
6267
  * 包括顶层 `undefined`、`BigInt`、循环引用或序列化过程抛错。
6263
6268
  * @throws {@link HbMiniProgramSDKError} `STORAGE_QUOTA_EXCEEDED`:完整 JSON 字符串的 UTF-8
6264
- * 字节数超过当前 Host 配额。
6269
+ * 字节数超过当前 Host 配额,或写入新 key 后当前小程序的不同 key 数量将超过 1000 个。
6265
6270
  * @throws {@link HbMiniProgramSDKError} `PERMISSION_NOT_DECLARED` / `PERMISSION_DENIED`:当前
6266
6271
  * 版本未声明或未启用 `storage`;`INVALID_STATE`:canonical 小程序身份尚未就绪。
6267
6272
  * @throws {@link HbMiniProgramSDKError} `METHOD_NOT_FOUND` / `METHOD_FORBIDDEN`:当前 Host
@@ -155,6 +155,8 @@ interface MiniappManifest {
155
155
  bindAppIds?: readonly string[];
156
156
  /** 发布类别;历史读取可缺省,发布校验必须提供。 */
157
157
  category?: MiniappCategory;
158
+ /** 简介,最多 200 个字符;未声明时简介页不展示。 */
159
+ desc?: string;
158
160
  }
159
161
  /**
160
162
  * 判断小程序版本是否符合公开 Manifest 版本规则。
@@ -211,6 +213,7 @@ declare function isValidMiniappManifestVersion(version: string): boolean;
211
213
  * 成功仅表示 Manifest 字段通过校验,不能替代文件检查与服务端发布预检。
212
214
  */
213
215
  declare function validateMiniappManifestForDeploy(manifest: MiniappManifest): {
216
+ desc?: string | undefined;
214
217
  category?: MiniappCategory | undefined;
215
218
  bindAppIds?: readonly string[] | undefined;
216
219
  window?: MiniappWindowDeclaration | undefined;
@@ -149,6 +149,7 @@ declare const HB_SDK_MINI_PROGRAM_MANIFEST_ACCESS_TOKEN_ENV = "HB_SDK_MINI_PROGR
149
149
  * 图片源路径相对项目目录;icon 为 200×200,封面 1–5 张,每张不超过 10 MiB / 4000 万像素。
150
150
  * build 会复制图片到输出目录 `_hb/basic-info/`,并将 Manifest 路径改为生成路径,不改写源图片;
151
151
  * - `heybox.category`:`tool`、`game` 或 `other`;构建时允许缺省,发布预检要求提供;
152
+ * - `heybox.desc`:可选简介,最多 200 个字符,写入 manifest 后在小程序简介页展示;
152
153
  * - `heybox.platforms`:项目实际承诺适配的非空、无重复平台 allowlist;输出按平台词表规范排序。
153
154
  * 声明仍停留在旧模板移动端默认(`android`、`ios`、`ohos`)时,`serve` 与 `build` 都只输出
154
155
  * 一条非阻断提示,不影响构建结果;