@heybox/hb-sdk 0.9.0-alpha.2 → 0.9.0-alpha.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/CHANGELOG.md +6 -0
- package/README.md +5 -0
- package/dist/cli-chunks/{build-CvxoPTJb.cjs → build-C4d4WXYT.cjs} +5 -5
- package/dist/cli-chunks/{context-ChyajSZV.cjs → context-mt_ERryB.cjs} +2 -2
- package/dist/cli-chunks/{create-vXFVQGD7.cjs → create-LfZ8OhT6.cjs} +1 -1
- package/dist/cli-chunks/{dev-QH1jaFr1.cjs → dev-lgUgVorS.cjs} +9 -9
- package/dist/cli-chunks/{doctor-CU25P_q2.cjs → doctor-BSJnY0Bu.cjs} +1 -1
- package/dist/cli-chunks/{index-QY5q1rWs.cjs → index-BtqxUixL.cjs} +15 -15
- package/dist/cli-chunks/{index-I2MJ0S1h.cjs → index-DVALw2rx.cjs} +2 -2
- package/dist/cli-chunks/{index.esm-81ZfQF1o.cjs → index.esm-Deim9BX8.cjs} +7 -7
- package/dist/cli-chunks/{login-DCNzO2CY.cjs → login-TIFXGbKv.cjs} +2 -2
- package/dist/cli-chunks/{project-vite-BA81QqiJ.cjs → project-vite-DSBP8NLj.cjs} +1 -1
- package/dist/cli-chunks/{remote-CBuPWvcD.cjs → remote-DyGb3YBA.cjs} +83 -17
- package/dist/cli-chunks/{runtime-gate-C1gdlVUB.cjs → runtime-gate-CWUZK4aE.cjs} +1 -1
- package/dist/cli-chunks/{runtime-permission-env-w3sXIJU4.cjs → runtime-permission-env-DdWYFrFT.cjs} +39 -6
- package/dist/cli-chunks/{session-Dtkbu4vT.cjs → session-CWCq-oeW.cjs} +1 -1
- package/dist/cli-chunks/{skill-DKgQa7PY.cjs → skill-DQzR5fMS.cjs} +2 -2
- package/dist/cli-chunks/{version-NZ-E_XUT.cjs → version-4zRtvcVD.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/devtools/browser-dev-host/assets/{browser-dev-host-CRdzRTKL.js → browser-dev-host-BEJTrPTS.js} +1 -1
- package/dist/devtools/browser-dev-host/assets/{desktop-app-launch-Cx-1tLJI.js → desktop-app-launch-Dod9L2SF.js} +1 -1
- package/dist/devtools/browser-dev-host/assets/{index-DAO9aQMF.js → index-xtE6gn7j.js} +3 -3
- package/dist/devtools/browser-dev-host/index.html +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/miniapp-publish.cjs.js +38 -5
- package/dist/miniapp-publish.esm.js +38 -5
- package/dist/vite.cjs.js +1 -1
- package/dist/vite.esm.js +1 -1
- package/package.json +6 -6
- package/skill/skill.json +4 -4
- package/types/miniapp-publish/index.d.ts +13 -3
|
@@ -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-
|
|
9
|
-
<link rel="modulepreload" crossorigin href="/assets/desktop-app-launch-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-xtE6gn7j.js"></script>
|
|
9
|
+
<link rel="modulepreload" crossorigin href="/assets/desktop-app-launch-Dod9L2SF.js">
|
|
10
10
|
<link rel="stylesheet" crossorigin href="/assets/index-0Ac39Njs.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
package/dist/index.cjs.js
CHANGED
|
@@ -1342,7 +1342,7 @@ function createMessageId() {
|
|
|
1342
1342
|
/** 构建时替换为当前发布包的实际版本。 */
|
|
1343
1343
|
const HB_SDK_VERSION = typeof undefined === 'string'
|
|
1344
1344
|
? undefined
|
|
1345
|
-
: '0.9.0-alpha.
|
|
1345
|
+
: '0.9.0-alpha.3';
|
|
1346
1346
|
|
|
1347
1347
|
const RUNTIME_MODES = new Set(['production', 'preview', 'development', 'unknown']);
|
|
1348
1348
|
const OPERATING_SYSTEM_NAMES = new Set(['android', 'ios', 'ohos', 'windows', 'macos', 'linux', 'unknown']);
|
package/dist/index.esm.js
CHANGED
|
@@ -1338,7 +1338,7 @@ function createMessageId() {
|
|
|
1338
1338
|
/** 构建时替换为当前发布包的实际版本。 */
|
|
1339
1339
|
const HB_SDK_VERSION = typeof undefined === 'string'
|
|
1340
1340
|
? undefined
|
|
1341
|
-
: '0.9.0-alpha.
|
|
1341
|
+
: '0.9.0-alpha.3';
|
|
1342
1342
|
|
|
1343
1343
|
const RUNTIME_MODES = new Set(['production', 'preview', 'development', 'unknown']);
|
|
1344
1344
|
const OPERATING_SYSTEM_NAMES = new Set(['android', 'ios', 'ohos', 'windows', 'macos', 'linux', 'unknown']);
|
|
@@ -3252,6 +3252,7 @@ function validateGeneratedCompanions(value) {
|
|
|
3252
3252
|
return undefined;
|
|
3253
3253
|
if (!isRecord$1(value) || Object.keys(value).length === 0)
|
|
3254
3254
|
throw new Error('manifest.companions 必须是非空对象');
|
|
3255
|
+
let descriptorCount = 0;
|
|
3255
3256
|
for (const [alias, definition] of Object.entries(value)) {
|
|
3256
3257
|
if (!/^[a-z][a-z0-9-]{0,31}$/.test(alias) ||
|
|
3257
3258
|
!isRecord$1(definition) ||
|
|
@@ -3265,6 +3266,9 @@ function validateGeneratedCompanions(value) {
|
|
|
3265
3266
|
Object.keys(definition.targets).length === 0)
|
|
3266
3267
|
throw new Error(`manifest.companions.${alias} 不合法`);
|
|
3267
3268
|
for (const [target, artifact] of Object.entries(definition.targets)) {
|
|
3269
|
+
descriptorCount += 1;
|
|
3270
|
+
if (descriptorCount > 64)
|
|
3271
|
+
throw new Error('manifest.companions 最多允许 64 个 target 描述符');
|
|
3268
3272
|
if (isRecord$1(artifact) && artifact.elevation === 'required') {
|
|
3269
3273
|
throw new Error(`manifest.companions.${alias}.targets.${target}.elevation V1 仅支持 none,暂不支持管理员权限启动`);
|
|
3270
3274
|
}
|
|
@@ -12400,8 +12404,9 @@ function createMiniappArtifactFileHeader(file) {
|
|
|
12400
12404
|
* 校验服务端 session 文件映射,并计算仍需上传的文件。
|
|
12401
12405
|
*
|
|
12402
12406
|
* @param localFiles - 本地构建产物 receipt;除 `relativePath` 和 `size` 外,每项必须包含 64 位小写十六进制 `sha256`。
|
|
12403
|
-
* @param serverFiles -
|
|
12407
|
+
* @param serverFiles - 服务端签发的会话文件映射;与复用的 Companion 合起来必须覆盖本地产物。
|
|
12404
12408
|
* @param uploadedKeys - 服务端已确认上传成功的 key;每个值都必须属于当前会话,重复值会被去重。
|
|
12409
|
+
* @param reusedCompanionFiles - 已验证 Blob 引用;仅允许当前产物中的 Companion 文件。
|
|
12405
12410
|
* @returns
|
|
12406
12411
|
* 包含三个字段的对象:`files` 是按路径 UTF-8 字节序排列的全部 `{ file, key }` 映射,
|
|
12407
12412
|
* `missingFiles` 是其中尚未确认上传的映射,`uploadedKeys` 是去重后的已上传 key。
|
|
@@ -12417,15 +12422,38 @@ function createMiniappArtifactFileHeader(file) {
|
|
|
12417
12422
|
* sha256: 'a'.repeat(64),
|
|
12418
12423
|
* }],
|
|
12419
12424
|
* [],
|
|
12425
|
+
* [],
|
|
12420
12426
|
* );
|
|
12421
12427
|
*
|
|
12422
12428
|
* console.log(resolved.missingFiles.length); // 1
|
|
12423
12429
|
* ```
|
|
12424
12430
|
*/
|
|
12425
|
-
function resolveMiniappUploadSessionFiles(localFiles, serverFiles, uploadedKeys) {
|
|
12431
|
+
function resolveMiniappUploadSessionFiles(localFiles, serverFiles, uploadedKeys, reusedCompanionFiles) {
|
|
12426
12432
|
const preparedFiles = prepareMiniappArtifactFiles(localFiles);
|
|
12427
|
-
if (serverFiles.length !== preparedFiles.length) {
|
|
12428
|
-
throw new Error(`上传会话文件数量异常:期望 ${preparedFiles.length},实际 ${serverFiles.length}`);
|
|
12433
|
+
if (serverFiles.length + reusedCompanionFiles.length !== preparedFiles.length) {
|
|
12434
|
+
throw new Error(`上传会话文件数量异常:期望 ${preparedFiles.length},实际 ${serverFiles.length + reusedCompanionFiles.length}`);
|
|
12435
|
+
}
|
|
12436
|
+
const localByPath = new Map(preparedFiles.map((file) => [file.relativePath, file]));
|
|
12437
|
+
const reused = new Map();
|
|
12438
|
+
for (const reference of reusedCompanionFiles) {
|
|
12439
|
+
const relativePath = normalizeMiniappArtifactRelativePath(reference.relative_path);
|
|
12440
|
+
const local = localByPath.get(relativePath);
|
|
12441
|
+
if (!relativePath.startsWith('companions/') || !local) {
|
|
12442
|
+
throw new Error(`上传会话返回了不属于当前 Companion 产物的 Blob 引用:${relativePath}`);
|
|
12443
|
+
}
|
|
12444
|
+
if (reused.has(relativePath)) {
|
|
12445
|
+
throw new Error(`上传会话返回重复 Blob 引用:${relativePath}`);
|
|
12446
|
+
}
|
|
12447
|
+
if (!Number.isSafeInteger(reference.size) || reference.size < 0 || reference.size !== local.size) {
|
|
12448
|
+
throw new Error(`上传会话 Blob 文件大小与本地构建不一致:${relativePath}`);
|
|
12449
|
+
}
|
|
12450
|
+
if (!('sha256' in local) || !/^[a-f0-9]{64}$/.test(reference.sha256) || reference.sha256 !== local.sha256) {
|
|
12451
|
+
throw new Error(`上传会话 Blob 文件 SHA-256 与本地构建不一致:${relativePath}`);
|
|
12452
|
+
}
|
|
12453
|
+
if (typeof reference.blob_id !== 'string' || !reference.blob_id.trim()) {
|
|
12454
|
+
throw new Error(`上传会话 Blob 引用 ID 无效:${relativePath}`);
|
|
12455
|
+
}
|
|
12456
|
+
reused.set(relativePath, reference);
|
|
12429
12457
|
}
|
|
12430
12458
|
const mappings = new Map();
|
|
12431
12459
|
const serverSizes = new Map();
|
|
@@ -12436,6 +12464,9 @@ function resolveMiniappUploadSessionFiles(localFiles, serverFiles, uploadedKeys)
|
|
|
12436
12464
|
if (mappings.has(relativePath)) {
|
|
12437
12465
|
throw new Error(`上传会话返回重复文件路径:${relativePath}`);
|
|
12438
12466
|
}
|
|
12467
|
+
if (reused.has(relativePath)) {
|
|
12468
|
+
throw new Error(`上传会话同时返回文件 key 和 Blob 引用:${relativePath}`);
|
|
12469
|
+
}
|
|
12439
12470
|
const key = String(serverFile.key || '');
|
|
12440
12471
|
if (!key) {
|
|
12441
12472
|
throw new Error(`上传会话未返回文件 key:${relativePath}`);
|
|
@@ -12456,7 +12487,8 @@ function resolveMiniappUploadSessionFiles(localFiles, serverFiles, uploadedKeys)
|
|
|
12456
12487
|
serverHashes.set(relativePath, sha256);
|
|
12457
12488
|
knownKeys.add(key);
|
|
12458
12489
|
}
|
|
12459
|
-
const
|
|
12490
|
+
const sessionFiles = preparedFiles.filter((file) => !reused.has(file.relativePath));
|
|
12491
|
+
const files = sessionFiles.map((file) => {
|
|
12460
12492
|
const key = mappings.get(file.relativePath);
|
|
12461
12493
|
if (!key) {
|
|
12462
12494
|
throw new Error(`上传会话缺少文件映射:${file.relativePath}`);
|
|
@@ -12481,6 +12513,7 @@ function resolveMiniappUploadSessionFiles(localFiles, serverFiles, uploadedKeys)
|
|
|
12481
12513
|
files,
|
|
12482
12514
|
missingFiles: files.filter((file) => !completed.has(file.key)),
|
|
12483
12515
|
uploadedKeys: [...completed],
|
|
12516
|
+
reusedCompanionFiles: [...reused.values()],
|
|
12484
12517
|
};
|
|
12485
12518
|
}
|
|
12486
12519
|
/**
|
|
@@ -3250,6 +3250,7 @@ function validateGeneratedCompanions(value) {
|
|
|
3250
3250
|
return undefined;
|
|
3251
3251
|
if (!isRecord$1(value) || Object.keys(value).length === 0)
|
|
3252
3252
|
throw new Error('manifest.companions 必须是非空对象');
|
|
3253
|
+
let descriptorCount = 0;
|
|
3253
3254
|
for (const [alias, definition] of Object.entries(value)) {
|
|
3254
3255
|
if (!/^[a-z][a-z0-9-]{0,31}$/.test(alias) ||
|
|
3255
3256
|
!isRecord$1(definition) ||
|
|
@@ -3263,6 +3264,9 @@ function validateGeneratedCompanions(value) {
|
|
|
3263
3264
|
Object.keys(definition.targets).length === 0)
|
|
3264
3265
|
throw new Error(`manifest.companions.${alias} 不合法`);
|
|
3265
3266
|
for (const [target, artifact] of Object.entries(definition.targets)) {
|
|
3267
|
+
descriptorCount += 1;
|
|
3268
|
+
if (descriptorCount > 64)
|
|
3269
|
+
throw new Error('manifest.companions 最多允许 64 个 target 描述符');
|
|
3266
3270
|
if (isRecord$1(artifact) && artifact.elevation === 'required') {
|
|
3267
3271
|
throw new Error(`manifest.companions.${alias}.targets.${target}.elevation V1 仅支持 none,暂不支持管理员权限启动`);
|
|
3268
3272
|
}
|
|
@@ -12398,8 +12402,9 @@ function createMiniappArtifactFileHeader(file) {
|
|
|
12398
12402
|
* 校验服务端 session 文件映射,并计算仍需上传的文件。
|
|
12399
12403
|
*
|
|
12400
12404
|
* @param localFiles - 本地构建产物 receipt;除 `relativePath` 和 `size` 外,每项必须包含 64 位小写十六进制 `sha256`。
|
|
12401
|
-
* @param serverFiles -
|
|
12405
|
+
* @param serverFiles - 服务端签发的会话文件映射;与复用的 Companion 合起来必须覆盖本地产物。
|
|
12402
12406
|
* @param uploadedKeys - 服务端已确认上传成功的 key;每个值都必须属于当前会话,重复值会被去重。
|
|
12407
|
+
* @param reusedCompanionFiles - 已验证 Blob 引用;仅允许当前产物中的 Companion 文件。
|
|
12403
12408
|
* @returns
|
|
12404
12409
|
* 包含三个字段的对象:`files` 是按路径 UTF-8 字节序排列的全部 `{ file, key }` 映射,
|
|
12405
12410
|
* `missingFiles` 是其中尚未确认上传的映射,`uploadedKeys` 是去重后的已上传 key。
|
|
@@ -12415,15 +12420,38 @@ function createMiniappArtifactFileHeader(file) {
|
|
|
12415
12420
|
* sha256: 'a'.repeat(64),
|
|
12416
12421
|
* }],
|
|
12417
12422
|
* [],
|
|
12423
|
+
* [],
|
|
12418
12424
|
* );
|
|
12419
12425
|
*
|
|
12420
12426
|
* console.log(resolved.missingFiles.length); // 1
|
|
12421
12427
|
* ```
|
|
12422
12428
|
*/
|
|
12423
|
-
function resolveMiniappUploadSessionFiles(localFiles, serverFiles, uploadedKeys) {
|
|
12429
|
+
function resolveMiniappUploadSessionFiles(localFiles, serverFiles, uploadedKeys, reusedCompanionFiles) {
|
|
12424
12430
|
const preparedFiles = prepareMiniappArtifactFiles(localFiles);
|
|
12425
|
-
if (serverFiles.length !== preparedFiles.length) {
|
|
12426
|
-
throw new Error(`上传会话文件数量异常:期望 ${preparedFiles.length},实际 ${serverFiles.length}`);
|
|
12431
|
+
if (serverFiles.length + reusedCompanionFiles.length !== preparedFiles.length) {
|
|
12432
|
+
throw new Error(`上传会话文件数量异常:期望 ${preparedFiles.length},实际 ${serverFiles.length + reusedCompanionFiles.length}`);
|
|
12433
|
+
}
|
|
12434
|
+
const localByPath = new Map(preparedFiles.map((file) => [file.relativePath, file]));
|
|
12435
|
+
const reused = new Map();
|
|
12436
|
+
for (const reference of reusedCompanionFiles) {
|
|
12437
|
+
const relativePath = normalizeMiniappArtifactRelativePath(reference.relative_path);
|
|
12438
|
+
const local = localByPath.get(relativePath);
|
|
12439
|
+
if (!relativePath.startsWith('companions/') || !local) {
|
|
12440
|
+
throw new Error(`上传会话返回了不属于当前 Companion 产物的 Blob 引用:${relativePath}`);
|
|
12441
|
+
}
|
|
12442
|
+
if (reused.has(relativePath)) {
|
|
12443
|
+
throw new Error(`上传会话返回重复 Blob 引用:${relativePath}`);
|
|
12444
|
+
}
|
|
12445
|
+
if (!Number.isSafeInteger(reference.size) || reference.size < 0 || reference.size !== local.size) {
|
|
12446
|
+
throw new Error(`上传会话 Blob 文件大小与本地构建不一致:${relativePath}`);
|
|
12447
|
+
}
|
|
12448
|
+
if (!('sha256' in local) || !/^[a-f0-9]{64}$/.test(reference.sha256) || reference.sha256 !== local.sha256) {
|
|
12449
|
+
throw new Error(`上传会话 Blob 文件 SHA-256 与本地构建不一致:${relativePath}`);
|
|
12450
|
+
}
|
|
12451
|
+
if (typeof reference.blob_id !== 'string' || !reference.blob_id.trim()) {
|
|
12452
|
+
throw new Error(`上传会话 Blob 引用 ID 无效:${relativePath}`);
|
|
12453
|
+
}
|
|
12454
|
+
reused.set(relativePath, reference);
|
|
12427
12455
|
}
|
|
12428
12456
|
const mappings = new Map();
|
|
12429
12457
|
const serverSizes = new Map();
|
|
@@ -12434,6 +12462,9 @@ function resolveMiniappUploadSessionFiles(localFiles, serverFiles, uploadedKeys)
|
|
|
12434
12462
|
if (mappings.has(relativePath)) {
|
|
12435
12463
|
throw new Error(`上传会话返回重复文件路径:${relativePath}`);
|
|
12436
12464
|
}
|
|
12465
|
+
if (reused.has(relativePath)) {
|
|
12466
|
+
throw new Error(`上传会话同时返回文件 key 和 Blob 引用:${relativePath}`);
|
|
12467
|
+
}
|
|
12437
12468
|
const key = String(serverFile.key || '');
|
|
12438
12469
|
if (!key) {
|
|
12439
12470
|
throw new Error(`上传会话未返回文件 key:${relativePath}`);
|
|
@@ -12454,7 +12485,8 @@ function resolveMiniappUploadSessionFiles(localFiles, serverFiles, uploadedKeys)
|
|
|
12454
12485
|
serverHashes.set(relativePath, sha256);
|
|
12455
12486
|
knownKeys.add(key);
|
|
12456
12487
|
}
|
|
12457
|
-
const
|
|
12488
|
+
const sessionFiles = preparedFiles.filter((file) => !reused.has(file.relativePath));
|
|
12489
|
+
const files = sessionFiles.map((file) => {
|
|
12458
12490
|
const key = mappings.get(file.relativePath);
|
|
12459
12491
|
if (!key) {
|
|
12460
12492
|
throw new Error(`上传会话缺少文件映射:${file.relativePath}`);
|
|
@@ -12479,6 +12511,7 @@ function resolveMiniappUploadSessionFiles(localFiles, serverFiles, uploadedKeys)
|
|
|
12479
12511
|
files,
|
|
12480
12512
|
missingFiles: files.filter((file) => !completed.has(file.key)),
|
|
12481
12513
|
uploadedKeys: [...completed],
|
|
12514
|
+
reusedCompanionFiles: [...reused.values()],
|
|
12482
12515
|
};
|
|
12483
12516
|
}
|
|
12484
12517
|
/**
|
package/dist/vite.cjs.js
CHANGED
|
@@ -2948,7 +2948,7 @@ async function ensureBasicInfoDirectory(rootPath, relative) {
|
|
|
2948
2948
|
/** 构建时替换为当前发布包的实际版本。 */
|
|
2949
2949
|
const HB_SDK_VERSION = typeof undefined === 'string'
|
|
2950
2950
|
? undefined
|
|
2951
|
-
: '0.9.0-alpha.
|
|
2951
|
+
: '0.9.0-alpha.3';
|
|
2952
2952
|
|
|
2953
2953
|
/**
|
|
2954
2954
|
* iframe 与调试台页面的开发期 console 捕获转发。
|
package/dist/vite.esm.js
CHANGED
|
@@ -2945,7 +2945,7 @@ async function ensureBasicInfoDirectory(rootPath, relative) {
|
|
|
2945
2945
|
/** 构建时替换为当前发布包的实际版本。 */
|
|
2946
2946
|
const HB_SDK_VERSION = typeof undefined === 'string'
|
|
2947
2947
|
? undefined
|
|
2948
|
-
: '0.9.0-alpha.
|
|
2948
|
+
: '0.9.0-alpha.3';
|
|
2949
2949
|
|
|
2950
2950
|
/**
|
|
2951
2951
|
* iframe 与调试台页面的开发期 console 捕获转发。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heybox/hb-sdk",
|
|
3
|
-
"version": "0.9.0-alpha.
|
|
3
|
+
"version": "0.9.0-alpha.3",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"./src/index.ts",
|
|
6
6
|
"./src/core/singleton.ts",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"undici": "^7.28.0",
|
|
66
66
|
"ws": "^8.18.0",
|
|
67
67
|
"sharp": "^0.34.5",
|
|
68
|
-
"@heybox/hb-sdk-protocol": "0.9.0-alpha.
|
|
68
|
+
"@heybox/hb-sdk-protocol": "0.9.0-alpha.3"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"vite": ">=5"
|
|
@@ -116,13 +116,13 @@
|
|
|
116
116
|
"vue-tsc": "^3.3.7",
|
|
117
117
|
"vite": "^8.0.12",
|
|
118
118
|
"vitest": "^3.2.4",
|
|
119
|
-
"@heybox/hb-api": "~1.28.9",
|
|
120
119
|
"@heybox-domain/heybox-theme": "~0.1.0",
|
|
121
120
|
"@heybox-domain/heybox-vue3-ui": "~0.1.0",
|
|
122
|
-
"@heybox/hb-
|
|
121
|
+
"@heybox/hb-api": "~1.28.10",
|
|
122
|
+
"@heybox/hb-sdk-runtime": "~0.9.0-alpha.3",
|
|
123
123
|
"@heybox/runtime": "~0.2.0",
|
|
124
|
-
"@heybox/runtime-
|
|
125
|
-
"@heybox/runtime-
|
|
124
|
+
"@heybox/runtime-policy": "~0.2.0",
|
|
125
|
+
"@heybox/runtime-transport-fetch": "~0.2.0"
|
|
126
126
|
},
|
|
127
127
|
"publishConfig": {
|
|
128
128
|
"registry": "https://registry.npmjs.org/",
|
package/skill/skill.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hb-sdk",
|
|
3
|
-
"skillVersion": "0.9.0-alpha.
|
|
3
|
+
"skillVersion": "0.9.0-alpha.3+skill.aa24d6656331",
|
|
4
4
|
"sdk": {
|
|
5
5
|
"package": "@heybox/hb-sdk",
|
|
6
|
-
"version": "0.9.0-alpha.
|
|
7
|
-
"compatibility": "0.9.0-alpha.
|
|
6
|
+
"version": "0.9.0-alpha.3",
|
|
7
|
+
"compatibility": "0.9.0-alpha.3"
|
|
8
8
|
},
|
|
9
9
|
"distribution": {
|
|
10
10
|
"type": "npm",
|
|
11
11
|
"package": "@heybox/hb-sdk",
|
|
12
|
-
"version": "0.9.0-alpha.
|
|
12
|
+
"version": "0.9.0-alpha.3",
|
|
13
13
|
"path": "skill"
|
|
14
14
|
},
|
|
15
15
|
"integrity": "sha256-aa24d6656331cbad8f6aae7735258a49d7f1a82f6e900415de53a1b93a30ddb8"
|
|
@@ -388,7 +388,7 @@ export interface MiniappArtifactFile {
|
|
|
388
388
|
/** 文件大小,单位为 bytes;必须是大于或等于 `0` 的 safe integer。 */
|
|
389
389
|
size: number;
|
|
390
390
|
}
|
|
391
|
-
/**
|
|
391
|
+
/** 上传会话使用的逐文件完整性凭据,由本地文件内容计算。 */
|
|
392
392
|
export interface MiniappArtifactFileReceipt extends MiniappArtifactFile {
|
|
393
393
|
/** 文件内容 SHA-256,使用 64 位小写十六进制字符串。 */
|
|
394
394
|
sha256: string;
|
|
@@ -404,6 +404,13 @@ export interface MiniappUploadSessionFile {
|
|
|
404
404
|
/** 服务端固化的文件内容 SHA-256,使用 64 位小写十六进制字符串。 */
|
|
405
405
|
sha256: string;
|
|
406
406
|
}
|
|
407
|
+
/** v2 上传会话复用的已验证 Companion Blob,不包含会话 CDN key。 */
|
|
408
|
+
export interface MiniappReusedCompanionFile {
|
|
409
|
+
relative_path: string;
|
|
410
|
+
size: number;
|
|
411
|
+
sha256: string;
|
|
412
|
+
blob_id: string;
|
|
413
|
+
}
|
|
407
414
|
/**
|
|
408
415
|
* 校验构建产物路径和大小,并按路径的 UTF-8 字节序稳定排序。
|
|
409
416
|
*
|
|
@@ -478,8 +485,9 @@ export declare function createMiniappArtifactFileHeader(file: MiniappArtifactFil
|
|
|
478
485
|
* 校验服务端 session 文件映射,并计算仍需上传的文件。
|
|
479
486
|
*
|
|
480
487
|
* @param localFiles - 本地构建产物 receipt;除 `relativePath` 和 `size` 外,每项必须包含 64 位小写十六进制 `sha256`。
|
|
481
|
-
* @param serverFiles -
|
|
488
|
+
* @param serverFiles - 服务端签发的会话文件映射;与复用的 Companion 合起来必须覆盖本地产物。
|
|
482
489
|
* @param uploadedKeys - 服务端已确认上传成功的 key;每个值都必须属于当前会话,重复值会被去重。
|
|
490
|
+
* @param reusedCompanionFiles - 已验证 Blob 引用;仅允许当前产物中的 Companion 文件。
|
|
483
491
|
* @returns
|
|
484
492
|
* 包含三个字段的对象:`files` 是按路径 UTF-8 字节序排列的全部 `{ file, key }` 映射,
|
|
485
493
|
* `missingFiles` 是其中尚未确认上传的映射,`uploadedKeys` 是去重后的已上传 key。
|
|
@@ -495,12 +503,13 @@ export declare function createMiniappArtifactFileHeader(file: MiniappArtifactFil
|
|
|
495
503
|
* sha256: 'a'.repeat(64),
|
|
496
504
|
* }],
|
|
497
505
|
* [],
|
|
506
|
+
* [],
|
|
498
507
|
* );
|
|
499
508
|
*
|
|
500
509
|
* console.log(resolved.missingFiles.length); // 1
|
|
501
510
|
* ```
|
|
502
511
|
*/
|
|
503
|
-
export declare function resolveMiniappUploadSessionFiles<T extends MiniappArtifactFile>(localFiles: readonly T[], serverFiles: readonly MiniappUploadSessionFile[], uploadedKeys: readonly string[]): {
|
|
512
|
+
export declare function resolveMiniappUploadSessionFiles<T extends MiniappArtifactFile>(localFiles: readonly T[], serverFiles: readonly MiniappUploadSessionFile[], uploadedKeys: readonly string[], reusedCompanionFiles: readonly MiniappReusedCompanionFile[]): {
|
|
504
513
|
files: {
|
|
505
514
|
file: T & {
|
|
506
515
|
relativePath: string;
|
|
@@ -514,6 +523,7 @@ export declare function resolveMiniappUploadSessionFiles<T extends MiniappArtifa
|
|
|
514
523
|
key: string;
|
|
515
524
|
}[];
|
|
516
525
|
uploadedKeys: string[];
|
|
526
|
+
reusedCompanionFiles: MiniappReusedCompanionFile[];
|
|
517
527
|
};
|
|
518
528
|
/**
|
|
519
529
|
* 校验 Manifest 中所有 Companion 归档都精确属于当前上传 receipt。
|