@heybox/hb-sdk 0.9.5-alpha.0 → 0.9.5-alpha.2

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 (30) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cli-chunks/{artifact-CuCw0Ist.cjs → artifact-BQm9xFcY.cjs} +3 -3
  3. package/dist/cli-chunks/{build-D7fJ6BEA.cjs → build-D6tP7Uje.cjs} +7 -5
  4. package/dist/cli-chunks/{create-B-Jsz3ik.cjs → create-BBXC3wLI.cjs} +3 -1
  5. package/dist/cli-chunks/{dev-y8113QN9.cjs → dev-XoWrqt1g.cjs} +8 -8
  6. package/dist/cli-chunks/{dev-context-BaWpob6H.cjs → dev-context-Gh3m20fd.cjs} +2 -2
  7. package/dist/cli-chunks/{doctor-BhKqJsAC.cjs → doctor-Cuc3EQQ8.cjs} +3 -1
  8. package/dist/cli-chunks/{games-DQx46pWD.cjs → games-CoddgAux.cjs} +5 -4
  9. package/dist/cli-chunks/{index-DBPhVlCg.cjs → index-CS6WpCn8.cjs} +502 -66
  10. package/dist/cli-chunks/{index-grzaqQfA.cjs → index-_1anHmAG.cjs} +1 -1
  11. package/dist/cli-chunks/{index.esm-DUwFJ64A.cjs → index.esm-CrdqnD7E.cjs} +8 -6
  12. package/dist/cli-chunks/{login-DqP3MO5K.cjs → login-Bk3T3PMe.cjs} +2 -1
  13. package/dist/cli-chunks/{project-vite-VEkDSWQG.cjs → project-vite-CL-SW3RW.cjs} +1 -1
  14. package/dist/cli-chunks/{remote-Bx-Pz3E9.cjs → remote-Dfg2HLIt.cjs} +8 -8
  15. package/dist/cli-chunks/{runtime-permission-env-CqU4F5WB.cjs → runtime-permission-env-CgH1Dz4q.cjs} +2 -2
  16. package/dist/cli-chunks/{skill-Fhveb4OH.cjs → skill-BGxlDR-g.cjs} +4 -2
  17. package/dist/cli-chunks/{version-CeN27XBV.cjs → version-B1hlMGq2.cjs} +1 -1
  18. package/dist/cli.cjs +3 -1
  19. package/dist/devtools/browser-dev-host/assets/{browser-dev-host-B-m1GRCg.js → browser-dev-host-BHv7t_Sz.js} +9 -9
  20. package/dist/devtools/browser-dev-host/assets/{desktop-app-launch-d7SJPK9b.js → desktop-app-launch-DlaXmxAI.js} +1 -1
  21. package/dist/devtools/browser-dev-host/assets/{index-DpmM52Ck.js → index-CmITJMxu.js} +3 -3
  22. package/dist/devtools/browser-dev-host/index.html +2 -2
  23. package/dist/index.cjs.js +1 -1
  24. package/dist/index.esm.js +1 -1
  25. package/dist/vite.cjs.js +1 -1
  26. package/dist/vite.esm.js +1 -1
  27. package/package.json +7 -7
  28. package/skill/SKILL.md +6 -0
  29. package/skill/skill.json +5 -5
  30. package/dist/cli-chunks/deploy-lock-BmDK-jPl.cjs +0 -148
@@ -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-DpmM52Ck.js"></script>
9
- <link rel="modulepreload" crossorigin href="/assets/desktop-app-launch-d7SJPK9b.js">
8
+ <script type="module" crossorigin src="/assets/index-CmITJMxu.js"></script>
9
+ <link rel="modulepreload" crossorigin href="/assets/desktop-app-launch-DlaXmxAI.js">
10
10
  <link rel="stylesheet" crossorigin href="/assets/index-h-fYisyX.css">
11
11
  </head>
12
12
  <body>
package/dist/index.cjs.js CHANGED
@@ -7492,7 +7492,7 @@ function createMessageId() {
7492
7492
  /** 构建时替换为当前发布包的实际版本。 */
7493
7493
  const HB_SDK_VERSION = typeof undefined === 'string'
7494
7494
  ? undefined
7495
- : '0.9.5-alpha.0';
7495
+ : '0.9.5-alpha.2';
7496
7496
 
7497
7497
  const RUNTIME_MODES = new Set(['production', 'preview', 'development', 'unknown']);
7498
7498
  const OPERATING_SYSTEM_NAMES = new Set(['android', 'ios', 'ohos', 'windows', 'macos', 'linux', 'unknown']);
package/dist/index.esm.js CHANGED
@@ -7488,7 +7488,7 @@ function createMessageId() {
7488
7488
  /** 构建时替换为当前发布包的实际版本。 */
7489
7489
  const HB_SDK_VERSION = typeof undefined === 'string'
7490
7490
  ? undefined
7491
- : '0.9.5-alpha.0';
7491
+ : '0.9.5-alpha.2';
7492
7492
 
7493
7493
  const RUNTIME_MODES = new Set(['production', 'preview', 'development', 'unknown']);
7494
7494
  const OPERATING_SYSTEM_NAMES = new Set(['android', 'ios', 'ohos', 'windows', 'macos', 'linux', 'unknown']);
package/dist/vite.cjs.js CHANGED
@@ -10329,7 +10329,7 @@ async function ensureBasicInfoDirectory(rootPath, relative) {
10329
10329
  /** 构建时替换为当前发布包的实际版本。 */
10330
10330
  const HB_SDK_VERSION = typeof undefined === 'string'
10331
10331
  ? undefined
10332
- : '0.9.5-alpha.0';
10332
+ : '0.9.5-alpha.2';
10333
10333
 
10334
10334
  /**
10335
10335
  * iframe 与调试台页面的开发期 console 捕获转发。
package/dist/vite.esm.js CHANGED
@@ -10326,7 +10326,7 @@ async function ensureBasicInfoDirectory(rootPath, relative) {
10326
10326
  /** 构建时替换为当前发布包的实际版本。 */
10327
10327
  const HB_SDK_VERSION = typeof undefined === 'string'
10328
10328
  ? undefined
10329
- : '0.9.5-alpha.0';
10329
+ : '0.9.5-alpha.2';
10330
10330
 
10331
10331
  /**
10332
10332
  * iframe 与调试台页面的开发期 console 捕获转发。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heybox/hb-sdk",
3
- "version": "0.9.5-alpha.0",
3
+ "version": "0.9.5-alpha.2",
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.5-alpha.0"
79
+ "@heybox/hb-sdk-protocol": "0.9.5-alpha.2"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "vite": ">=5"
@@ -129,12 +129,12 @@
129
129
  "@ai-desktop/view-contract": "file:../hb-sdk-protocol/vendor/view-contract-2.2.2-6ac49bbf6410.tgz",
130
130
  "rollup-plugin-dts": "6.4.0",
131
131
  "@heybox-domain/heybox-theme": "~0.1.0",
132
- "@heybox-domain/heybox-vue3-ui": "~0.1.0",
133
- "@heybox/hb-sdk-runtime": "~0.9.5-alpha.0",
134
132
  "@heybox/hb-api": "~1.28.19",
133
+ "@heybox-domain/heybox-vue3-ui": "~0.1.0",
134
+ "@heybox/hb-sdk-runtime": "~0.9.5-alpha.2",
135
135
  "@heybox/runtime": "~0.2.1",
136
- "@heybox/runtime-transport-fetch": "~0.2.1",
137
- "@heybox/runtime-policy": "~0.2.1"
136
+ "@heybox/runtime-policy": "~0.2.1",
137
+ "@heybox/runtime-transport-fetch": "~0.2.1"
138
138
  },
139
139
  "publishConfig": {
140
140
  "registry": "https://registry.npmjs.org/",
@@ -202,7 +202,7 @@
202
202
  "changelog:draft": "node scripts/changelog-draft.cjs",
203
203
  "check:changelog": "node scripts/check-changelog.cjs",
204
204
  "release:verify-tarball": "node scripts/skill/verify-tarball-install.mjs",
205
- "test:release": "node --test scripts/public-changelog.test.mjs scripts/public-changelog-workflow.test.cjs scripts/release-family.test.cjs ../../ops/jobs/publish-changed-packages/publish.test.cjs",
205
+ "test:release": "node --test scripts/release-notices.test.cjs scripts/public-changelog.test.mjs scripts/public-changelog-workflow.test.cjs scripts/release-family.test.cjs ../../ops/jobs/publish-changed-packages/publish.test.cjs ../../ops/jobs/release-hb-sdk/notify-release.test.cjs",
206
206
  "test:compatibility-evidence": "node --test scripts/validate-compatibility-evidence.test.mjs",
207
207
  "release:prepare": "node scripts/release-prepare.cjs",
208
208
  "release:tag": "node scripts/release-tag.cjs",
package/skill/SKILL.md CHANGED
@@ -23,6 +23,10 @@ Before upgrading, verify both the page layout and the captured image. Do not onl
23
23
 
24
24
  核对项目已安装的 SDK 与公告中的版本门槛。当前和计划契约均以本次读取的 canonical 文档为准,不提前套用未来契约,不把不支持结果当作设置成功,也不依赖旧 Skill 快照。建议升级前验证支持和不支持两种 Host。
25
25
 
26
+ ## 游戏存档接入检查
27
+
28
+ 接入游戏存档前,通过 canonical 文档索引读取游戏存档指南与方法 Reference,核对当前支持游戏和参数签名。查询结构化数据时区分已有结果读取与同步、解析;按游戏的数据结构检查多槽位、默认槽位和大整数字符串,不假定所有游戏返回同一套字段。同步被近期已有存档限制时,按文档中的业务错误码使用已有存档,不循环触发同步。
29
+
26
30
  ## Canonical Documentation
27
31
 
28
32
  The only maintained hb-sdk guidance source is:
@@ -36,6 +40,8 @@ Before giving hb-sdk-specific guidance or changing hb-sdk consumer code:
36
40
  3. Use the index titles and summaries to select the smallest relevant set of linked pages; do not guess page URLs.
37
41
  4. Resolve relative links against `https://docs.xiaoheihe.cn/hb_sdk/`, fetch those Markdown pages, and verify their responses before acting.
38
42
  5. Check the project's installed `@heybox/hb-sdk` version. If it may differ from the live documentation, read the compatibility and changelog pages linked by the index before recommending an API or CLI command.
43
+ 6. For proactive SDK update reminders, read the single approved CDN notice at `https://activity.xiaoheihe.cn/u/hb-sdk/approved-notice.json`. The indexed `Release notices` document is manually authored; it is not approval status. Match notices to the installed version and APIs used; link the applicable Changelog details. An empty or unavailable CDN document must not be represented as an approved announcement. Changelog remains the source for API facts and compatibility checks.
44
+ 7. When the task upgrades the SDK, prepares a build, or deploys or publishes a mini-program, read the changelog entries for every stable version after the installed version up to the target version, and check each `必须操作` item first. Decide whether it applies from the APIs, permissions, platforms, and CLI workflows the project actually uses; read the linked guide or migration page before changing code, then verify the change. Report applicable items that remain unhandled instead of skipping them silently.
39
45
 
40
46
  Do not use copied package references, an installed Skill snapshot, registry contents, remembered API shapes, or HTML documentation as a fallback. If the index or any required linked Markdown page is unavailable or invalid, report that the canonical hb-sdk documentation is unavailable and stop the hb-sdk-specific part of the task.
41
47
 
package/skill/skill.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "hb-sdk",
3
- "skillVersion": "0.9.5-alpha.0+skill.d0d502673711",
3
+ "skillVersion": "0.9.5-alpha.2+skill.fe3b525ecac8",
4
4
  "sdk": {
5
5
  "package": "@heybox/hb-sdk",
6
- "version": "0.9.5-alpha.0",
7
- "compatibility": "0.9.5-alpha.0"
6
+ "version": "0.9.5-alpha.2",
7
+ "compatibility": "0.9.5-alpha.2"
8
8
  },
9
9
  "distribution": {
10
10
  "type": "npm",
11
11
  "package": "@heybox/hb-sdk",
12
- "version": "0.9.5-alpha.0",
12
+ "version": "0.9.5-alpha.2",
13
13
  "path": "skill"
14
14
  },
15
- "integrity": "sha256-d0d502673711f5d077ee62e657749125788e396d5203894b7077dfe866fd2990"
15
+ "integrity": "sha256-fe3b525ecac8431e1774ee453864cf9ba58ff6897272e2356ceb17b621c8c427"
16
16
  }
@@ -1,148 +0,0 @@
1
- 'use strict';
2
-
3
- var node_crypto = require('node:crypto');
4
- var fs = require('node:fs/promises');
5
- var path = require('node:path');
6
- var index = require('./index-DBPhVlCg.cjs');
7
-
8
- const DEPLOY_LOCKED_MESSAGE = '当前设备已有同版本产物正在上传,请等待完成后重试';
9
- const DEPLOY_LOCK_DIRECTORY_NAME = 'deploy-locks';
10
- const DEPLOY_LOCK_OWNER_FILE = 'owner.json';
11
- const INCOMPLETE_LOCK_GRACE_MS = 30_000;
12
- const defaultPaths = index.envPaths('hb-sdk', { suffix: '' });
13
- class DeployLockConflictError extends Error {
14
- }
15
- async function withDeployLock(scope, operation, options = {}) {
16
- let lock;
17
- try {
18
- lock = await acquireDeployLock(scope, options);
19
- }
20
- catch (error) {
21
- if (error instanceof DeployLockConflictError) {
22
- throw error;
23
- }
24
- // 本地文件锁只减少重复操作,文件系统异常不阻断服务端上传流程。
25
- return operation();
26
- }
27
- try {
28
- return await operation();
29
- }
30
- finally {
31
- await lock.release().catch(() => undefined);
32
- }
33
- }
34
- async function acquireDeployLock(scope, options = {}) {
35
- const lockDirectory = getDeployLockDirectory(scope, options.cacheRoot);
36
- const ownerFile = path.join(lockDirectory, DEPLOY_LOCK_OWNER_FILE);
37
- const owner = {
38
- version: 1,
39
- pid: options.pid ?? process.pid,
40
- token: options.token ?? node_crypto.randomBytes(16).toString('hex'),
41
- };
42
- await fs.mkdir(path.dirname(lockDirectory), { recursive: true, mode: 0o700 });
43
- for (let attempt = 0; attempt < 2; attempt += 1) {
44
- let created = false;
45
- try {
46
- await fs.mkdir(lockDirectory, { mode: 0o700 });
47
- created = true;
48
- await fs.writeFile(ownerFile, `${JSON.stringify(owner)}\n`, { encoding: 'utf8', mode: 0o600 });
49
- return createDeployLock(lockDirectory, ownerFile, owner.token);
50
- }
51
- catch (error) {
52
- if (created) {
53
- await fs.rm(lockDirectory, { force: true, recursive: true });
54
- throw error;
55
- }
56
- if (!isNodeError(error) || error.code !== 'EEXIST') {
57
- throw error;
58
- }
59
- if (!(await canReclaimDeployLock(lockDirectory, ownerFile, options))) {
60
- throw new DeployLockConflictError(DEPLOY_LOCKED_MESSAGE);
61
- }
62
- await reclaimDeployLock(lockDirectory, owner.token);
63
- }
64
- }
65
- throw new DeployLockConflictError(DEPLOY_LOCKED_MESSAGE);
66
- }
67
- function getDeployLockDirectory(scope, cacheRoot = defaultPaths.cache) {
68
- const scopeHash = node_crypto.createHash('sha256').update(`${scope.apiBaseUrl}\0${scope.miniProgramId}\0${scope.version}`).digest('hex');
69
- return path.join(cacheRoot, DEPLOY_LOCK_DIRECTORY_NAME, scopeHash);
70
- }
71
- function createDeployLock(lockDirectory, ownerFile, token) {
72
- let released = false;
73
- return {
74
- async release() {
75
- if (released)
76
- return;
77
- released = true;
78
- await removeOwnedLock(lockDirectory, ownerFile, token);
79
- },
80
- };
81
- }
82
- async function canReclaimDeployLock(lockDirectory, ownerFile, options) {
83
- const owner = await readDeployLockOwner(ownerFile);
84
- if (owner) {
85
- return !(options.isProcessRunning ?? isProcessRunning)(owner.pid);
86
- }
87
- try {
88
- const lockStat = await fs.stat(lockDirectory);
89
- return (options.now ?? Date.now)() - lockStat.mtimeMs >= INCOMPLETE_LOCK_GRACE_MS;
90
- }
91
- catch (error) {
92
- return isNodeError(error) && error.code === 'ENOENT';
93
- }
94
- }
95
- async function removeOwnedLock(lockDirectory, ownerFile, token) {
96
- const owner = await readDeployLockOwner(ownerFile);
97
- if (owner?.token === token) {
98
- await fs.rm(lockDirectory, { force: true, recursive: true });
99
- }
100
- }
101
- async function reclaimDeployLock(lockDirectory, token) {
102
- const reclaimDirectory = `${lockDirectory}.reclaim-${node_crypto.createHash('sha256').update(token).digest('hex')}`;
103
- try {
104
- await fs.rename(lockDirectory, reclaimDirectory);
105
- }
106
- catch (error) {
107
- if (isNodeError(error) && error.code === 'ENOENT')
108
- return;
109
- throw error;
110
- }
111
- await fs.rm(reclaimDirectory, { force: true, recursive: true });
112
- }
113
- async function readDeployLockOwner(ownerFile) {
114
- try {
115
- const value = JSON.parse(await fs.readFile(ownerFile, 'utf8'));
116
- return isDeployLockOwner(value) ? value : null;
117
- }
118
- catch (error) {
119
- if (isNodeError(error) && error.code === 'ENOENT')
120
- return null;
121
- if (error instanceof SyntaxError)
122
- return null;
123
- throw error;
124
- }
125
- }
126
- function isDeployLockOwner(value) {
127
- return (typeof value === 'object' &&
128
- value !== null &&
129
- value.version === 1 &&
130
- Number.isInteger(value.pid) &&
131
- typeof value.token === 'string');
132
- }
133
- function isProcessRunning(pid) {
134
- try {
135
- process.kill(pid, 0);
136
- return true;
137
- }
138
- catch (error) {
139
- return !isNodeError(error) || error.code !== 'ESRCH';
140
- }
141
- }
142
- function isNodeError(error) {
143
- return error instanceof Error && 'code' in error;
144
- }
145
-
146
- exports.DEPLOY_LOCKED_MESSAGE = DEPLOY_LOCKED_MESSAGE;
147
- exports.acquireDeployLock = acquireDeployLock;
148
- exports.withDeployLock = withDeployLock;