@heybox/hb-sdk 0.8.1-alpha.10 → 0.8.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 (40) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +3 -3
  3. package/dist/cli-chunks/{build-CtqIXxDL.cjs → build-CZ5V15O8.cjs} +4 -4
  4. package/dist/cli-chunks/{context-t57bMfbr.cjs → context-Dtt13TVH.cjs} +2 -2
  5. package/dist/cli-chunks/{create-BDOPSacf.cjs → create-BH8rUeVn.cjs} +1 -1
  6. package/dist/cli-chunks/{dev-VxjconYc.cjs → dev-DlwR0N4E.cjs} +15 -10
  7. package/dist/cli-chunks/{doctor-BkfYdlnZ.cjs → doctor-BYj8lz7p.cjs} +1 -1
  8. package/dist/cli-chunks/{index-DDrytLTX.cjs → index-Dbep6fgT.cjs} +15 -15
  9. package/dist/cli-chunks/{index-lLaHzwfT.cjs → index-vPfFOCOM.cjs} +2 -2
  10. package/dist/cli-chunks/{index.esm-Dy4qRhuo.cjs → index.esm-BRKWKNSB.cjs} +7 -7
  11. package/dist/cli-chunks/{login-D2EX4R5_.cjs → login-CLVmbKuy.cjs} +2 -2
  12. package/dist/cli-chunks/{project-vite-CFhz2THK.cjs → project-vite-CSpSpfAR.cjs} +1 -1
  13. package/dist/cli-chunks/{remote-CfESZxO2.cjs → remote-BWAdpu4q.cjs} +6 -6
  14. package/dist/cli-chunks/{runtime-permission-env-BtTDFqEL.cjs → runtime-permission-env-B03m_ABy.cjs} +15 -1
  15. package/dist/cli-chunks/{session-Dkhwjqhm.cjs → session-B596v9X3.cjs} +1 -1
  16. package/dist/cli-chunks/{skill-DOveC5jt.cjs → skill-B-QW6Z7A.cjs} +2 -2
  17. package/dist/cli-chunks/{version-C4nE66sX.cjs → version-CNLhzVfO.cjs} +1 -1
  18. package/dist/cli.cjs +1 -1
  19. package/dist/devtools/browser-dev-host/assets/{browser-dev-host-BM9Qo_Ta.js → browser-dev-host-R1mwU2Tm.js} +9 -9
  20. package/dist/devtools/browser-dev-host/assets/{desktop-app-launch-C2I333Yn.js → desktop-app-launch-Nb5ZvAEU.js} +2 -2
  21. package/dist/devtools/browser-dev-host/assets/{index-Bnb6MMTv.js → index-BNVF7wG6.js} +4 -4
  22. package/dist/devtools/browser-dev-host/assets/{index-D-aNERAr.css → index-DXd5IZBz.css} +1 -1
  23. package/dist/devtools/browser-dev-host/index.html +3 -3
  24. package/dist/index.cjs.js +24 -24
  25. package/dist/index.esm.js +24 -24
  26. package/dist/protocol.cjs.js +27 -27
  27. package/dist/protocol.esm.js +27 -27
  28. package/dist/vite.cjs.js +1 -1
  29. package/dist/vite.esm.js +1 -1
  30. package/package.json +7 -7
  31. package/skill/SKILL.md +1 -1
  32. package/skill/references/api-root.md +6 -5
  33. package/skill/references/cli.md +1 -1
  34. package/skill/references/examples.md +2 -2
  35. package/skill/references/recipes.md +5 -4
  36. package/skill/references/safety-boundaries.md +2 -2
  37. package/skill/skill.json +5 -5
  38. package/types/miniapp-manifest/schema.d.ts +9 -0
  39. package/types/modules/files/types.d.ts +10 -11
  40. package/types/modules/network/index.d.ts +2 -2
@@ -331,32 +331,32 @@ const MINI_PROGRAM_PROTOCOL_CAPABILITIES = [
331
331
  ];
332
332
 
333
333
  function isMiniProgramBridgeMessage(value) {
334
- if (!isRecord$1(value))
334
+ if (!isRecord$2(value))
335
335
  return false;
336
- if (value.namespace !== MINI_PROGRAM_MESSAGE_NAMESPACE || (value.version !== 1 && value.version !== 2) || !isNonEmptyString(value.nonce)) {
336
+ if (value.namespace !== MINI_PROGRAM_MESSAGE_NAMESPACE || (value.version !== 1 && value.version !== 2) || !isNonEmptyString$1(value.nonce)) {
337
337
  return false;
338
338
  }
339
339
  if (value.type === 'handshake') {
340
- return isNonEmptyString(value.id) && value.method === SDK_HANDSHAKE_METHOD && value.error === undefined && isSDKHandshakePayload(value.payload);
340
+ return isNonEmptyString$1(value.id) && value.method === SDK_HANDSHAKE_METHOD && value.error === undefined && isSDKHandshakePayload(value.payload);
341
341
  }
342
342
  if (value.type === 'request') {
343
- return isNonEmptyString(value.id) && isNonEmptyString(value.method) && value.error === undefined;
343
+ return isNonEmptyString$1(value.id) && isNonEmptyString$1(value.method) && value.error === undefined;
344
344
  }
345
345
  if (value.type === 'response') {
346
- return (isNonEmptyString(value.id) &&
347
- (value.method === undefined || isNonEmptyString(value.method)) &&
346
+ return (isNonEmptyString$1(value.id) &&
347
+ (value.method === undefined || isNonEmptyString$1(value.method)) &&
348
348
  (value.error === undefined || isBridgeError(value.error)));
349
349
  }
350
350
  if (value.type === 'event') {
351
- if (!isNonEmptyString(value.method) || value.error !== undefined)
351
+ if (!isNonEmptyString$1(value.method) || value.error !== undefined)
352
352
  return false;
353
353
  if (value.method === MINI_PROGRAM_OPERATION_PROGRESS_METHOD) {
354
- return value.version === 2 && isNonEmptyString(value.id) && isMiniProgramOperationProgressPayload(value.payload);
354
+ return value.version === 2 && isNonEmptyString$1(value.id) && isMiniProgramOperationProgressPayload(value.payload);
355
355
  }
356
- return value.id === undefined || isNonEmptyString(value.id);
356
+ return value.id === undefined || isNonEmptyString$1(value.id);
357
357
  }
358
358
  if (value.type === 'cancel') {
359
- return (value.version === 2 && isNonEmptyString(value.id) && value.method === undefined && value.payload === undefined && value.error === undefined);
359
+ return (value.version === 2 && isNonEmptyString$1(value.id) && value.method === undefined && value.payload === undefined && value.error === undefined);
360
360
  }
361
361
  return false;
362
362
  }
@@ -369,40 +369,40 @@ function isMiniProgramRelativePath(value) {
369
369
  return value.split('/').every((segment) => Boolean(segment) && segment !== '.' && segment !== '..');
370
370
  }
371
371
  function isMiniProgramPathRootRef(value) {
372
- if (!isRecord$1(value))
372
+ if (!isRecord$2(value))
373
373
  return false;
374
374
  if (value.kind === 'sandbox')
375
375
  return hasOnlyKeys(value, ['kind']);
376
- return value.kind === 'directory' && isNonEmptyString(value.handleId) && hasOnlyKeys(value, ['kind', 'handleId']);
376
+ return value.kind === 'directory' && isNonEmptyString$1(value.handleId) && hasOnlyKeys(value, ['kind', 'handleId']);
377
377
  }
378
378
  function isMiniProgramFileRef(value) {
379
- if (!isRecord$1(value) || value.kind !== 'file')
379
+ if (!isRecord$2(value) || value.kind !== 'file')
380
380
  return false;
381
- if (isNonEmptyString(value.handleId)) {
381
+ if (isNonEmptyString$1(value.handleId)) {
382
382
  return hasOnlyKeys(value, ['kind', 'handleId']);
383
383
  }
384
384
  return (isMiniProgramPathRootRef(value.root) && isMiniProgramRelativePath(value.relativePath) && hasOnlyKeys(value, ['kind', 'root', 'relativePath']));
385
385
  }
386
386
  function isMiniProgramDirectoryRef(value) {
387
- if (!isRecord$1(value) || value.kind !== 'directory')
387
+ if (!isRecord$2(value) || value.kind !== 'directory')
388
388
  return false;
389
- if (isNonEmptyString(value.handleId)) {
389
+ if (isNonEmptyString$1(value.handleId)) {
390
390
  return hasOnlyKeys(value, ['kind', 'handleId']);
391
391
  }
392
392
  return (isMiniProgramPathRootRef(value.root) && (value.relativePath === '.' || isMiniProgramRelativePath(value.relativePath)) && hasOnlyKeys(value, ['kind', 'root', 'relativePath']));
393
393
  }
394
394
  function isMiniProgramFileDescriptor(value) {
395
- return (isRecord$1(value) &&
395
+ return (isRecord$2(value) &&
396
396
  value.kind === 'file' &&
397
- isNonEmptyString(value.name) &&
397
+ isNonEmptyString$1(value.name) &&
398
398
  isFileMode(value.mode) &&
399
399
  isMiniProgramFileRef(value.ref) &&
400
400
  hasOnlyKeys(value, ['kind', 'name', 'mode', 'ref']));
401
401
  }
402
402
  function isMiniProgramDirectoryDescriptor(value) {
403
- return (isRecord$1(value) &&
403
+ return (isRecord$2(value) &&
404
404
  value.kind === 'directory' &&
405
- isNonEmptyString(value.name) &&
405
+ isNonEmptyString$1(value.name) &&
406
406
  isFileMode(value.mode) &&
407
407
  isMiniProgramDirectoryRef(value.ref) &&
408
408
  hasOnlyKeys(value, ['kind', 'name', 'mode', 'ref']));
@@ -414,7 +414,7 @@ function isMiniProgramByteArray(value) {
414
414
  return value instanceof Uint8Array && value.buffer instanceof ArrayBuffer;
415
415
  }
416
416
  function isMiniProgramFileStat(value) {
417
- return (isRecord$1(value) &&
417
+ return (isRecord$2(value) &&
418
418
  value.kind === 'file' &&
419
419
  isNonNegativeSafeInteger(value.size) &&
420
420
  (value.modifiedAt === undefined || isNonNegativeFiniteNumber(value.modifiedAt)) &&
@@ -422,7 +422,7 @@ function isMiniProgramFileStat(value) {
422
422
  hasOnlyKeys(value, ['kind', 'size', 'modifiedAt', 'createdAt']));
423
423
  }
424
424
  function isMiniProgramDownloadProgressPayload(value) {
425
- if (!isRecord$1(value) ||
425
+ if (!isRecord$2(value) ||
426
426
  !isNonNegativeSafeInteger(value.loaded) ||
427
427
  typeof value.lengthComputable !== 'boolean' ||
428
428
  !hasOnlyKeys(value, ['loaded', 'total', 'lengthComputable'])) {
@@ -433,7 +433,7 @@ function isMiniProgramDownloadProgressPayload(value) {
433
433
  return isNonNegativeSafeInteger(value.total) && value.loaded <= value.total;
434
434
  }
435
435
  function isMiniProgramCompanionPrepareProgress(value) {
436
- if (!isRecord$1(value))
436
+ if (!isRecord$2(value))
437
437
  return false;
438
438
  if (value.phase === 'downloading') {
439
439
  return (isNonNegativeSafeInteger(value.loaded) &&
@@ -451,10 +451,10 @@ function isMiniProgramOperationProgressPayload(value) {
451
451
  return isMiniProgramDownloadProgressPayload(value) || isMiniProgramCompanionPrepareProgress(value);
452
452
  }
453
453
  function isSDKHandshakePayload(value) {
454
- return isRecord$1(value) && isNonEmptyString(value.href) && typeof value.userAgent === 'string' && isNonEmptyString(value.sdkVersion);
454
+ return isRecord$2(value) && isNonEmptyString$1(value.href) && typeof value.userAgent === 'string' && isNonEmptyString$1(value.sdkVersion);
455
455
  }
456
456
  function isBridgeError(value) {
457
- return isRecord$1(value) && isNonEmptyString(value.code) && typeof value.message === 'string';
457
+ return isRecord$2(value) && isNonEmptyString$1(value.code) && typeof value.message === 'string';
458
458
  }
459
459
  function isFileMode(value) {
460
460
  return value === 'read' || value === 'readwrite';
@@ -465,14 +465,14 @@ function isNonNegativeSafeInteger(value) {
465
465
  function isNonNegativeFiniteNumber(value) {
466
466
  return typeof value === 'number' && Number.isFinite(value) && value >= 0;
467
467
  }
468
- function isNonEmptyString(value) {
468
+ function isNonEmptyString$1(value) {
469
469
  return typeof value === 'string' && value.length > 0;
470
470
  }
471
471
  function hasOnlyKeys(value, allowedKeys) {
472
472
  const allowed = new Set(allowedKeys);
473
473
  return Object.keys(value).every((key) => allowed.has(key));
474
474
  }
475
- function isRecord$1(value) {
475
+ function isRecord$2(value) {
476
476
  return typeof value === 'object' && value !== null && !Array.isArray(value);
477
477
  }
478
478
 
@@ -329,32 +329,32 @@ const MINI_PROGRAM_PROTOCOL_CAPABILITIES = [
329
329
  ];
330
330
 
331
331
  function isMiniProgramBridgeMessage(value) {
332
- if (!isRecord$1(value))
332
+ if (!isRecord$2(value))
333
333
  return false;
334
- if (value.namespace !== MINI_PROGRAM_MESSAGE_NAMESPACE || (value.version !== 1 && value.version !== 2) || !isNonEmptyString(value.nonce)) {
334
+ if (value.namespace !== MINI_PROGRAM_MESSAGE_NAMESPACE || (value.version !== 1 && value.version !== 2) || !isNonEmptyString$1(value.nonce)) {
335
335
  return false;
336
336
  }
337
337
  if (value.type === 'handshake') {
338
- return isNonEmptyString(value.id) && value.method === SDK_HANDSHAKE_METHOD && value.error === undefined && isSDKHandshakePayload(value.payload);
338
+ return isNonEmptyString$1(value.id) && value.method === SDK_HANDSHAKE_METHOD && value.error === undefined && isSDKHandshakePayload(value.payload);
339
339
  }
340
340
  if (value.type === 'request') {
341
- return isNonEmptyString(value.id) && isNonEmptyString(value.method) && value.error === undefined;
341
+ return isNonEmptyString$1(value.id) && isNonEmptyString$1(value.method) && value.error === undefined;
342
342
  }
343
343
  if (value.type === 'response') {
344
- return (isNonEmptyString(value.id) &&
345
- (value.method === undefined || isNonEmptyString(value.method)) &&
344
+ return (isNonEmptyString$1(value.id) &&
345
+ (value.method === undefined || isNonEmptyString$1(value.method)) &&
346
346
  (value.error === undefined || isBridgeError(value.error)));
347
347
  }
348
348
  if (value.type === 'event') {
349
- if (!isNonEmptyString(value.method) || value.error !== undefined)
349
+ if (!isNonEmptyString$1(value.method) || value.error !== undefined)
350
350
  return false;
351
351
  if (value.method === MINI_PROGRAM_OPERATION_PROGRESS_METHOD) {
352
- return value.version === 2 && isNonEmptyString(value.id) && isMiniProgramOperationProgressPayload(value.payload);
352
+ return value.version === 2 && isNonEmptyString$1(value.id) && isMiniProgramOperationProgressPayload(value.payload);
353
353
  }
354
- return value.id === undefined || isNonEmptyString(value.id);
354
+ return value.id === undefined || isNonEmptyString$1(value.id);
355
355
  }
356
356
  if (value.type === 'cancel') {
357
- return (value.version === 2 && isNonEmptyString(value.id) && value.method === undefined && value.payload === undefined && value.error === undefined);
357
+ return (value.version === 2 && isNonEmptyString$1(value.id) && value.method === undefined && value.payload === undefined && value.error === undefined);
358
358
  }
359
359
  return false;
360
360
  }
@@ -367,40 +367,40 @@ function isMiniProgramRelativePath(value) {
367
367
  return value.split('/').every((segment) => Boolean(segment) && segment !== '.' && segment !== '..');
368
368
  }
369
369
  function isMiniProgramPathRootRef(value) {
370
- if (!isRecord$1(value))
370
+ if (!isRecord$2(value))
371
371
  return false;
372
372
  if (value.kind === 'sandbox')
373
373
  return hasOnlyKeys(value, ['kind']);
374
- return value.kind === 'directory' && isNonEmptyString(value.handleId) && hasOnlyKeys(value, ['kind', 'handleId']);
374
+ return value.kind === 'directory' && isNonEmptyString$1(value.handleId) && hasOnlyKeys(value, ['kind', 'handleId']);
375
375
  }
376
376
  function isMiniProgramFileRef(value) {
377
- if (!isRecord$1(value) || value.kind !== 'file')
377
+ if (!isRecord$2(value) || value.kind !== 'file')
378
378
  return false;
379
- if (isNonEmptyString(value.handleId)) {
379
+ if (isNonEmptyString$1(value.handleId)) {
380
380
  return hasOnlyKeys(value, ['kind', 'handleId']);
381
381
  }
382
382
  return (isMiniProgramPathRootRef(value.root) && isMiniProgramRelativePath(value.relativePath) && hasOnlyKeys(value, ['kind', 'root', 'relativePath']));
383
383
  }
384
384
  function isMiniProgramDirectoryRef(value) {
385
- if (!isRecord$1(value) || value.kind !== 'directory')
385
+ if (!isRecord$2(value) || value.kind !== 'directory')
386
386
  return false;
387
- if (isNonEmptyString(value.handleId)) {
387
+ if (isNonEmptyString$1(value.handleId)) {
388
388
  return hasOnlyKeys(value, ['kind', 'handleId']);
389
389
  }
390
390
  return (isMiniProgramPathRootRef(value.root) && (value.relativePath === '.' || isMiniProgramRelativePath(value.relativePath)) && hasOnlyKeys(value, ['kind', 'root', 'relativePath']));
391
391
  }
392
392
  function isMiniProgramFileDescriptor(value) {
393
- return (isRecord$1(value) &&
393
+ return (isRecord$2(value) &&
394
394
  value.kind === 'file' &&
395
- isNonEmptyString(value.name) &&
395
+ isNonEmptyString$1(value.name) &&
396
396
  isFileMode(value.mode) &&
397
397
  isMiniProgramFileRef(value.ref) &&
398
398
  hasOnlyKeys(value, ['kind', 'name', 'mode', 'ref']));
399
399
  }
400
400
  function isMiniProgramDirectoryDescriptor(value) {
401
- return (isRecord$1(value) &&
401
+ return (isRecord$2(value) &&
402
402
  value.kind === 'directory' &&
403
- isNonEmptyString(value.name) &&
403
+ isNonEmptyString$1(value.name) &&
404
404
  isFileMode(value.mode) &&
405
405
  isMiniProgramDirectoryRef(value.ref) &&
406
406
  hasOnlyKeys(value, ['kind', 'name', 'mode', 'ref']));
@@ -412,7 +412,7 @@ function isMiniProgramByteArray(value) {
412
412
  return value instanceof Uint8Array && value.buffer instanceof ArrayBuffer;
413
413
  }
414
414
  function isMiniProgramFileStat(value) {
415
- return (isRecord$1(value) &&
415
+ return (isRecord$2(value) &&
416
416
  value.kind === 'file' &&
417
417
  isNonNegativeSafeInteger(value.size) &&
418
418
  (value.modifiedAt === undefined || isNonNegativeFiniteNumber(value.modifiedAt)) &&
@@ -420,7 +420,7 @@ function isMiniProgramFileStat(value) {
420
420
  hasOnlyKeys(value, ['kind', 'size', 'modifiedAt', 'createdAt']));
421
421
  }
422
422
  function isMiniProgramDownloadProgressPayload(value) {
423
- if (!isRecord$1(value) ||
423
+ if (!isRecord$2(value) ||
424
424
  !isNonNegativeSafeInteger(value.loaded) ||
425
425
  typeof value.lengthComputable !== 'boolean' ||
426
426
  !hasOnlyKeys(value, ['loaded', 'total', 'lengthComputable'])) {
@@ -431,7 +431,7 @@ function isMiniProgramDownloadProgressPayload(value) {
431
431
  return isNonNegativeSafeInteger(value.total) && value.loaded <= value.total;
432
432
  }
433
433
  function isMiniProgramCompanionPrepareProgress(value) {
434
- if (!isRecord$1(value))
434
+ if (!isRecord$2(value))
435
435
  return false;
436
436
  if (value.phase === 'downloading') {
437
437
  return (isNonNegativeSafeInteger(value.loaded) &&
@@ -449,10 +449,10 @@ function isMiniProgramOperationProgressPayload(value) {
449
449
  return isMiniProgramDownloadProgressPayload(value) || isMiniProgramCompanionPrepareProgress(value);
450
450
  }
451
451
  function isSDKHandshakePayload(value) {
452
- return isRecord$1(value) && isNonEmptyString(value.href) && typeof value.userAgent === 'string' && isNonEmptyString(value.sdkVersion);
452
+ return isRecord$2(value) && isNonEmptyString$1(value.href) && typeof value.userAgent === 'string' && isNonEmptyString$1(value.sdkVersion);
453
453
  }
454
454
  function isBridgeError(value) {
455
- return isRecord$1(value) && isNonEmptyString(value.code) && typeof value.message === 'string';
455
+ return isRecord$2(value) && isNonEmptyString$1(value.code) && typeof value.message === 'string';
456
456
  }
457
457
  function isFileMode(value) {
458
458
  return value === 'read' || value === 'readwrite';
@@ -463,14 +463,14 @@ function isNonNegativeSafeInteger(value) {
463
463
  function isNonNegativeFiniteNumber(value) {
464
464
  return typeof value === 'number' && Number.isFinite(value) && value >= 0;
465
465
  }
466
- function isNonEmptyString(value) {
466
+ function isNonEmptyString$1(value) {
467
467
  return typeof value === 'string' && value.length > 0;
468
468
  }
469
469
  function hasOnlyKeys(value, allowedKeys) {
470
470
  const allowed = new Set(allowedKeys);
471
471
  return Object.keys(value).every((key) => allowed.has(key));
472
472
  }
473
- function isRecord$1(value) {
473
+ function isRecord$2(value) {
474
474
  return typeof value === 'object' && value !== null && !Array.isArray(value);
475
475
  }
476
476
 
package/dist/vite.cjs.js CHANGED
@@ -11,7 +11,7 @@ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentS
11
11
  /** 构建时替换为当前发布包的实际版本。 */
12
12
  const HB_SDK_VERSION = typeof undefined === 'string'
13
13
  ? undefined
14
- : '0.8.1-alpha.10';
14
+ : '0.8.1-alpha.12';
15
15
 
16
16
  /**
17
17
  * iframe 与调试台页面的开发期 console 捕获转发。
package/dist/vite.esm.js CHANGED
@@ -8,7 +8,7 @@ import { AsyncLocalStorage } from 'node:async_hooks';
8
8
  /** 构建时替换为当前发布包的实际版本。 */
9
9
  const HB_SDK_VERSION = typeof undefined === 'string'
10
10
  ? undefined
11
- : '0.8.1-alpha.10';
11
+ : '0.8.1-alpha.12';
12
12
 
13
13
  /**
14
14
  * iframe 与调试台页面的开发期 console 捕获转发。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heybox/hb-sdk",
3
- "version": "0.8.1-alpha.10",
3
+ "version": "0.8.1-alpha.12",
4
4
  "sideEffects": [
5
5
  "./src/index.ts",
6
6
  "./src/core/singleton.ts",
@@ -62,7 +62,7 @@
62
62
  "skills": "1.5.23",
63
63
  "undici": "^7.28.0",
64
64
  "ws": "^8.18.0",
65
- "@heybox/hb-sdk-protocol": "0.8.1-alpha.10"
65
+ "@heybox/hb-sdk-protocol": "0.8.1-alpha.12"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "vite": ">=5"
@@ -113,13 +113,13 @@
113
113
  "vue-tsc": "^3.3.7",
114
114
  "vite": "^8.0.12",
115
115
  "vitest": "^3.2.4",
116
- "@heybox-domain/heybox-theme": "~0.1.0",
117
- "@heybox/hb-api": "~1.28.3",
116
+ "@heybox/hb-sdk-runtime": "~0.8.1-alpha.12",
118
117
  "@heybox-domain/heybox-vue3-ui": "~0.1.0",
119
- "@heybox/hb-sdk-runtime": "~0.8.1-alpha.10",
120
- "@heybox/runtime": "~0.2.0",
121
118
  "@heybox/runtime-policy": "~0.2.0",
122
- "@heybox/runtime-transport-fetch": "~0.2.0"
119
+ "@heybox/runtime-transport-fetch": "~0.2.0",
120
+ "@heybox/runtime": "~0.2.0",
121
+ "@heybox/hb-api": "~1.28.3",
122
+ "@heybox-domain/heybox-theme": "~0.1.0"
123
123
  },
124
124
  "publishConfig": {
125
125
  "registry": "https://registry.npmjs.org/",
package/skill/SKILL.md CHANGED
@@ -51,7 +51,7 @@ Apply these instructions when writing, reviewing, or debugging code that consume
51
51
  10. When authorization UI is required, call `auth.login()` from a trusted user action. Missing gesture returns `USER_GESTURE_REQUIRED`; cancelling, rejecting, or closing returns `AUTHORIZATION_CANCELLED` and does not confirm or change authorization. An already-authorized `auth.login()` request may return a new code silently.
52
52
  11. Use `share.showShareMenu({ post })` or `share.screenshot({ post })` to preset editable community destinations and topics. Pass partition IDs through `topicIds` and topic text without surrounding `#` through `topics`; do not construct the underlying client post protocol.
53
53
  12. Use `share.showShareMenu({ extra })` to open the share menu or `share.copyLink({ extra })` to copy and return the mini-program share link. `share.showShareMenu()` always uses the platform `common_share` landing page and does not accept a custom `url`. Read the JSON-compatible page state synchronously with `share.getExtra()` after launch, validate the developer-defined fields, and fall back to the default page when it returns `undefined`.
54
- 13. New PC enables the retained `files` and `network.download()` contract with persistent sandbox storage, single-file/directory pickers, exact File saving, and public-network streaming downloads. Mobile, Web, Browser Dev Host, and legacy PC return `METHOD_FORBIDDEN` and provide no memory/Blob fallback. Call `files.pickFiles()` / `pickDirectory()` / `saveFile()` only from trusted user actions; `saveFile()` accepts only `suggestedName`, `remove()` only deletes sandbox objects, and non-empty directories require `remove({ recursive: true })`.
54
+ 13. New PC enables the retained `files` and `network.download()` contract with persistent sandbox storage, single-file/directory pickers, exact File saving, and public-network streaming downloads. Android/iOS `1.3.396+` additionally require the Host to advertise the corresponding Native operations through `system.describe`; missing handlers, negotiation timeout, or partial operation sets fail closed per capability. Web, Browser Dev Host, and legacy PC return `METHOD_FORBIDDEN` and provide no memory/Blob fallback. Call `files.pickFiles()` / `pickDirectory()` / `saveFile()` only from trusted user actions; `saveFile()` accepts only `suggestedName`, `remove()` only deletes sandbox objects, and non-empty directories require `remove({ recursive: true })`.
55
55
  14. Use `network.download()` only with an SDK-created File/Directory target. It is GET-only, does not follow redirects, and exposes local `AbortSignal` / progress callbacks without sending functions over the bridge. Abort is a cancellation intent; a Host commit that already won still resolves successfully.
56
56
  15. Use `companion.prepare()` and `companion.launch()` only from separate trusted user actions. Launch does not prepare implicitly. Treat stdio as raw `Uint8Array` with at-least-once output delivery, and implement business framing and sequence de-duplication explicitly.
57
57
  16. Use `environment.getInfo()` for the immutable runtime, Host App, canonical Mini-program, operating-system, and SDK version snapshot. It waits for the handshake automatically. Use `environment.getInfoSync()` only after `getHandshakeState().status === 'ready'` or inside a ready-state subscription; before that it throws `ENVIRONMENT_NOT_READY`.
@@ -27,7 +27,7 @@
27
27
  ## Package metadata
28
28
 
29
29
  - Package: `@heybox/hb-sdk`
30
- - Version at generation time: `0.8.1-alpha.10`
30
+ - Version at generation time: `0.8.1-alpha.12`
31
31
  - Public root export: `@heybox/hb-sdk`
32
32
  - Protocol export: `@heybox/hb-sdk/protocol`
33
33
  - Vite plugin export: `@heybox/hb-sdk/vite`
@@ -457,13 +457,14 @@ try {
457
457
  | Host | `files.sandbox` | 外部 picker | `network.download()` |
458
458
  | ---------------- | --------------- | ----------- | -------------------- |
459
459
  | 新 PC | 支持 | 支持 | 支持 |
460
- | Mobile | 不支持 | 不支持 | 不支持 |
460
+ | Mobile | 支持 | 支持 | 支持 |
461
461
  | Web | 不支持 | 不支持 | 不支持 |
462
462
  | Browser Dev Host | 不支持 | 不支持 | 不支持 |
463
463
 
464
464
  当前 Runtime 认识但 Host 未实现时返回 `METHOD_FORBIDDEN`;旧 Runtime 收到新 method 时返回
465
- `METHOD_NOT_FOUND`。新 PC V1 注入真实文件与流式下载 primitive;其他当前 Host 未实现时仍不
466
- 提供 throwing stub、Blob 或内存假下载。
465
+ `METHOD_NOT_FOUND`。新 PC 注入真实文件与流式下载 primitive;Android/iOS `1.3.396+` 还需在
466
+ 启动时通过 `system.describe` 宣告对应 Native operations。缺失 handler、协商超时或 operation
467
+ 不完整时对应能力保持关闭,且不提供 throwing stub、Blob 或内存假下载。
467
468
 
468
469
  ### 路径与创建
469
470
 
@@ -643,7 +644,7 @@ try {
643
644
  - `USER_GESTURE_REQUIRED` 表示潜在授权 UI 缺少可信用户手势,应让用户点击按钮后重试。
644
645
  - `AUTHORIZATION_CANCELLED` 表示用户取消、拒绝或关闭授权页面,应正常结束当前操作。
645
646
  - `SERVER_API_REQUIRED` 表示当前用户数据必须经开发者服务端 OpenAPI 获取,不应在页面重试对应 Host API。
646
- - `METHOD_FORBIDDEN` 表示当前 Host 未实现或关闭对应能力。V1 files/download 在 Mobile、Web 和 Browser Dev Host 都会得到该错误。
647
+ - `METHOD_FORBIDDEN` 表示当前 Host 未实现或关闭对应能力。V1 files/download 在 Web、Browser Dev Host 和未实现该能力的旧版 Host 会得到该错误;Android/iOS `1.3.396+` 需先经 `system.describe` 协商到对应 operation 集。
647
648
  - `ENVIRONMENT_NOT_READY` 表示在 SDK 完成握手前调用了 `environment.getInfoSync()`;一般改用会自动等待的 `environment.getInfo()`。
648
649
  - `FILE_PICKER_CANCELLED` 表示用户取消了外部文件或目录选择,应正常结束当前操作。
649
650
  - `DOWNLOAD_CANCELLED` 表示取消意图先于 Host 提交生效;Host 已完成提交时仍返回成功。`DOWNLOAD_TIMEOUT` 表示网络空闲超时,失败不会改动原目标。
@@ -115,7 +115,7 @@ CLI 会启动页面服务并自动打开 Vue 3 本地调试台。左侧集中放
115
115
 
116
116
  `hb-sdk dev` 从项目 `package.json` 读取开发者声明,并在远端权限快照可用时读取平台批准结果。只有当前版本声明且平台已批准 `network` 时才跳过平台 CSP;`useOfficialDomain` 不参与该判定。调试台不提供权限或平台批准修改入口;快照缺失或无效时保留平台 CSP。
117
117
 
118
- 调试台右上角的桌面图标与手机二维码按钮使用相同样式。点击桌面图标后选择小黑盒正式版或 Debug 版,选择后立即请求客户端打开当前本地小程序,不需要再点一次确认;上次选择的客户端会在本地记忆。桌面调试只接受无凭据的 `http://127.0.0.1:<port>`,拒绝 `localhost`、IPv6 和 LAN 地址,不提供地址选择;手机二维码仍维护独立的局域网选择。项目未绑定或本地调试启动票不可用时,菜单会显示不可用原因。
118
+ 调试台右上角的桌面图标与手机二维码按钮使用相同样式。桌面图标只在该项目于 `package.json#heybox.platforms` 声明了桌面平台(`windows`、`macos` 或 `linux`)时展示,未声明桌面平台的项目不显示该入口。点击桌面图标后选择小黑盒正式版或 Debug 版,选择后立即请求客户端打开当前本地小程序,不需要再点一次确认;上次选择的客户端会在本地记忆。桌面调试只接受无凭据的 `http://127.0.0.1:<port>`,拒绝 `localhost`、IPv6 和 LAN 地址,不提供地址选择;手机二维码仍维护独立的局域网选择。项目未绑定或本地调试启动票不可用时,入口保持展示但两个客户端选项置灰不可用。
119
119
 
120
120
  桌面打开使用 `ai-desktop://v1/extensions/ai-desktop.heybox-user-miniprogram/open`,Debug 客户端使用 `ai-desktop-debug://`。URI 只包含 `mini_program_id` 与 `mini_url`,不包含启动票、权限快照或客户端执行参数;detail 仍从 `mini_url` 同源的 `/__hb_sdk__/launch.json` 读取最新启动事实并由后端验证。浏览器无法取得外部协议的可靠完成回执,所以界面只显示“已请求打开”,不会声明成功,也不会自动 fallback 到另一个客户端。
121
121
 
@@ -193,8 +193,8 @@ export default defineConfig({
193
193
  - Do not call unsupported storage delete/clear/info operations.
194
194
  - Do not pass raw internal share/network protocol fields from mini-program code.
195
195
  - Do not send `multipart/form-data` (or handcrafted multipart bodies) through `network.request`; use form-urlencoded string body or a dedicated upload capability.
196
- - Do not pass string paths, browser File System Access handles, Blob targets, Range/resume fields, or upload bodies to `network.download`; use SDK-created File/Directory handles on new PC.
197
- - Do not treat Mobile, Web, Browser Dev Host, or legacy PC as evidence for files/download support. Only new PC currently implements the retained contract; other Hosts return `METHOD_FORBIDDEN` and provide no memory fallback.
196
+ - Do not pass string paths, browser File System Access handles, Blob targets, Range/resume fields, or upload bodies to `network.download`; use SDK-created File/Directory handles on new PC, or on Android/iOS `1.3.396+` after the Native contract is negotiated.
197
+ - Do not treat Web, Browser Dev Host, or legacy PC as evidence for files/download support. New PC implements the retained contract; Android/iOS `1.3.396+` additionally require matching Native operations from `system.describe`. Missing handlers, negotiation timeout, and partial operation sets fail closed per capability; other Hosts return `METHOD_FORBIDDEN` and provide no memory fallback.
198
198
  - Do not pass executable paths, dynamic args, cwd, environment variables, shell commands, URLs, hashes, or native process identifiers to `companion`. Only the reviewed Manifest may define launch inputs.
199
199
  - Treat `companion.prepare()` and `companion.launch()` as separate trusted-user-gesture and Host-authorization operations. Launch never prepares implicitly.
200
200
  - Companion stdio is raw `Uint8Array` with at-least-once output delivery. Business protocols own framing, sequence de-duplication, replay, and reconnection.
@@ -138,13 +138,14 @@ try {
138
138
  | Host | `files.sandbox` | 外部 picker | `network.download()` |
139
139
  | ---------------- | --------------- | ----------- | -------------------- |
140
140
  | 新 PC | 支持 | 支持 | 支持 |
141
- | Mobile | 不支持 | 不支持 | 不支持 |
141
+ | Mobile | 支持 | 支持 | 支持 |
142
142
  | Web | 不支持 | 不支持 | 不支持 |
143
143
  | Browser Dev Host | 不支持 | 不支持 | 不支持 |
144
144
 
145
145
  当前 Runtime 认识但 Host 未实现时返回 `METHOD_FORBIDDEN`;旧 Runtime 收到新 method 时返回
146
- `METHOD_NOT_FOUND`。新 PC V1 注入真实文件与流式下载 primitive;其他当前 Host 未实现时仍不
147
- 提供 throwing stub、Blob 或内存假下载。
146
+ `METHOD_NOT_FOUND`。新 PC 注入真实文件与流式下载 primitive;Android/iOS `1.3.396+` 还需在
147
+ 启动时通过 `system.describe` 宣告对应 Native operations。缺失 handler、协商超时或 operation
148
+ 不完整时对应能力保持关闭,且不提供 throwing stub、Blob 或内存假下载。
148
149
 
149
150
  ### 路径与创建
150
151
 
@@ -416,7 +417,7 @@ try {
416
417
  - `USER_GESTURE_REQUIRED` 表示潜在授权 UI 缺少可信用户手势,应让用户点击按钮后重试。
417
418
  - `AUTHORIZATION_CANCELLED` 表示用户取消、拒绝或关闭授权页面,应正常结束当前操作。
418
419
  - `SERVER_API_REQUIRED` 表示当前用户数据必须经开发者服务端 OpenAPI 获取,不应在页面重试对应 Host API。
419
- - `METHOD_FORBIDDEN` 表示当前 Host 未实现或关闭对应能力。V1 files/download 在 Mobile、Web 和 Browser Dev Host 都会得到该错误。
420
+ - `METHOD_FORBIDDEN` 表示当前 Host 未实现或关闭对应能力。V1 files/download 在 Web、Browser Dev Host 和未实现该能力的旧版 Host 会得到该错误;Android/iOS `1.3.396+` 需先经 `system.describe` 协商到对应 operation 集。
420
421
  - `ENVIRONMENT_NOT_READY` 表示在 SDK 完成握手前调用了 `environment.getInfoSync()`;一般改用会自动等待的 `environment.getInfo()`。
421
422
  - `FILE_PICKER_CANCELLED` 表示用户取消了外部文件或目录选择,应正常结束当前操作。
422
423
  - `DOWNLOAD_CANCELLED` 表示取消意图先于 Host 提交生效;Host 已完成提交时仍返回成功。`DOWNLOAD_TIMEOUT` 表示网络空闲超时,失败不会改动原目标。
@@ -22,8 +22,8 @@
22
22
  - 公开 `network.request()` 与 `network.download()` 均使用 no-follow redirect policy;3xx 不会在 Host 内静默跳转。
23
23
  - `network.request()` 不能访问平台保留的 runtime auth 与 OpenAPI 内部路径;页面不得持有或交换服务端应用凭据。
24
24
  - `network.request` 不支持 `multipart/form-data`;App Host 仅支持 form(`application/x-www-form-urlencoded`)与 JSON。表单请用 `URLSearchParams#toString()` 作为 `data`,文件上传请走专用上传能力。
25
- - 新 PC 开放持久 sandbox、单文件/目录 picker、精确 File 保存与公网 `network.download()`;多选和小黑盒域名流式下载暂不支持。Mobile、Web 与 Browser Dev Host 仍未开放这些 primitive。
26
- - `withCredentials` 不再是支持的配置字段,也不会进入新 SDK、协议或 Host contract;旧 SDK 构建产物的 wire 字段仅由 Runtime 兼容忽略。Mobile 对官方 HTTPS 默认端口目标自动启用 Native Cookie,第三方关闭;应用可显式提供 `Cookie`、`Authorization` 等请求头。`Origin`、`Referer`、`User-Agent` 由 Host 接管;`Host`、分帧及逐跳请求头由传输层管理,不能由小程序设置。Web Host 使用浏览器 Fetch,无法发送显式 `Cookie` 等浏览器禁止的头,会返回 `REQUEST_UNSUPPORTED`;需要第三方 Cookie 会话时请在支持原始请求头的 Mobile/PC Host 验收。
25
+ - 新 PC 开放持久 sandbox、单文件/目录 picker、精确 File 保存与公网 `network.download()`;Android/iOS `1.3.396+` 通过独立 Native host contract 提供 Files/Download,并用 `system.describe` 的实际 operation 集逐项启用,缺失 handler、握手超时或 operation 不完整时对应能力 fail closed。多选和小黑盒域名流式下载暂不支持;Web 与 Browser Dev Host 仍未开放这些 primitive。
26
+ - `withCredentials` 不再是支持的配置字段,也不会进入新 SDK、协议或 Host contract;旧 SDK 构建产物的 wire 字段仅由 Runtime 兼容忽略。Mobile 对官方 HTTPS 默认端口目标自动启用 Native Cookie,第三方关闭;应用可显式提供 `Cookie`、`Authorization` 等请求头。`Origin`、`Referer`、`User-Agent` 由 Host 接管;`Host`、分帧及逐跳请求头由传输层管理,不能由小程序设置。Web Host 使用浏览器 Fetch,无法发送显式 `Cookie` 等浏览器禁止的头,会返回 `REQUEST_UNSUPPORTED`;需要第三方 Cookie 会话时请在支持原始请求头的 Mobile/PC Host 验收。已启用的 Mobile 下载走无凭据 Native transfer;需要鉴权的下载请使用服务端签发的限时 URL。
27
27
  - 新 PC 不支持振动、分享菜单和截图分享;`navigation.openAppPage` 仅支持 `game_detail`,用户/帖子详情会明确失败。调用平台相关能力时应处理 `METHOD_FORBIDDEN` 或 `REQUEST_UNSUPPORTED`。
28
28
  - picker 必须来自可信用户手势;取消选择返回 `FILE_PICKER_CANCELLED`。`saveFile()` 只接受 `suggestedName`,不接受 `accept`。
29
29
  - `pickFiles()` / `pickDirectory()` 默认只读;`pickFiles()` 仅在显式传入 `multiple: true` 时允许 Host 返回多个文件。要写入或作为下载目标时显式请求 `mode: 'readwrite'`。
package/skill/skill.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "hb-sdk",
3
- "skillVersion": "0.8.1-alpha.10+skill.79d09c3b6cad",
3
+ "skillVersion": "0.8.1-alpha.12+skill.0ec2760a9aa0",
4
4
  "sdk": {
5
5
  "package": "@heybox/hb-sdk",
6
- "version": "0.8.1-alpha.10",
7
- "compatibility": "0.8.1-alpha.10"
6
+ "version": "0.8.1-alpha.12",
7
+ "compatibility": "0.8.1-alpha.12"
8
8
  },
9
9
  "distribution": {
10
10
  "type": "npm",
11
11
  "package": "@heybox/hb-sdk",
12
- "version": "0.8.1-alpha.10",
12
+ "version": "0.8.1-alpha.12",
13
13
  "path": "skill"
14
14
  },
15
- "integrity": "sha256-79d09c3b6cad5fe22962d813b7513e2ef23eda8f6ff5fb9ddc8d6778eb73a81f"
15
+ "integrity": "sha256-0ec2760a9aa09dc2c2d97237da7d3647bee16dc1c4e69df3216c0be22f9de1d7"
16
16
  }
@@ -3,6 +3,15 @@ import type { MiniappCompanionManifestDeclarations } from './companion-types';
3
3
  export declare const MINIAPP_TEMPLATE_VERSION = "0.0.0";
4
4
  export declare const MINIAPP_PLATFORM_VALUES: readonly ["android", "ios", "ohos", "windows", "macos", "linux"];
5
5
  export type MiniappPlatform = (typeof MINIAPP_PLATFORM_VALUES)[number];
6
+ /**
7
+ * 桌面平台子集:从唯一平台词表 `MINIAPP_PLATFORM_VALUES` 派生,`satisfies` 阻止它漂移出词表。
8
+ * 小程序声明其中任一平台,即视为该项目承诺适配 PC / 桌面端;调试台据此取舍桌面调试入口。
9
+ *
10
+ * 注意:子集只表达「声明为桌面」,不保证已有可用的客户端基线——例如 `linux` 目前既没有 `@hbPlatform` 声明,
11
+ * 也没有 Companion target,仅声明 `linux` 的项目会展示入口但未必能真正打开。
12
+ */
13
+ export declare const MINIAPP_DESKTOP_PLATFORM_VALUES: readonly ["windows", "macos", "linux"];
14
+ export declare function hasMiniappDesktopPlatform(platforms: readonly MiniappPlatform[] | undefined): boolean;
6
15
  export interface MiniappManifest {
7
16
  [key: string]: unknown;
8
17
  sdkVersion: string;
@@ -35,8 +35,8 @@ export interface PathRoot {
35
35
  * @hbPlatform ohos
36
36
  * @hbPlatform windows
37
37
  * @hbPlatform macos
38
- * @hbClient android none
39
- * @hbClient ios none
38
+ * @hbClient android numeric-dot \>= 1.3.396
39
+ * @hbClient ios numeric-dot \>= 1.3.396
40
40
  * @hbClient ohos none
41
41
  * @hbClient windows none
42
42
  * @hbClient macos none
@@ -53,8 +53,8 @@ export interface PathRoot {
53
53
  * @hbPlatform ohos
54
54
  * @hbPlatform windows
55
55
  * @hbPlatform macos
56
- * @hbClient android none
57
- * @hbClient ios none
56
+ * @hbClient android numeric-dot \>= 1.3.396
57
+ * @hbClient ios numeric-dot \>= 1.3.396
58
58
  * @hbClient ohos none
59
59
  * @hbClient windows none
60
60
  * @hbClient macos none
@@ -107,14 +107,15 @@ export interface FilesModule {
107
107
  *
108
108
  * @param options - 访问模式、扩展名筛选与多选设置。
109
109
  * @returns 用户选择的文件代理。
110
+ * @remarks Android `1.3.396` 的精确 SAF 文件仅支持只读选择;请求 `readwrite` 会返回 `FILE_ACCESS_DENIED`。
110
111
  * @since 0.8.0-alpha.2
111
112
  * @hbPlatform android
112
113
  * @hbPlatform ios
113
114
  * @hbPlatform ohos
114
115
  * @hbPlatform windows
115
116
  * @hbPlatform macos
116
- * @hbClient android none
117
- * @hbClient ios none
117
+ * @hbClient android numeric-dot \>= 1.3.396
118
+ * @hbClient ios numeric-dot \>= 1.3.396
118
119
  * @hbClient ohos none
119
120
  * @hbClient windows none
120
121
  * @hbClient macos none
@@ -131,8 +132,8 @@ export interface FilesModule {
131
132
  * @hbPlatform ohos
132
133
  * @hbPlatform windows
133
134
  * @hbPlatform macos
134
- * @hbClient android none
135
- * @hbClient ios none
135
+ * @hbClient android numeric-dot \>= 1.3.396
136
+ * @hbClient ios numeric-dot \>= 1.3.396
136
137
  * @hbClient ohos none
137
138
  * @hbClient windows none
138
139
  * @hbClient macos none
@@ -144,13 +145,11 @@ export interface FilesModule {
144
145
  * @param options - 建议文件名。
145
146
  * @returns 具备读写权限的目标文件代理。
146
147
  * @since 0.8.0-alpha.2
147
- * @hbPlatform android
148
148
  * @hbPlatform ios
149
149
  * @hbPlatform ohos
150
150
  * @hbPlatform windows
151
151
  * @hbPlatform macos
152
- * @hbClient android none
153
- * @hbClient ios none
152
+ * @hbClient ios numeric-dot \>= 1.3.396
154
153
  * @hbClient ohos none
155
154
  * @hbClient windows none
156
155
  * @hbClient macos none
@@ -135,8 +135,8 @@ export interface MiniProgramNetworkModule {
135
135
  * @hbPlatform ohos
136
136
  * @hbPlatform windows
137
137
  * @hbPlatform macos
138
- * @hbClient android none
139
- * @hbClient ios none
138
+ * @hbClient android numeric-dot \>= 1.3.396
139
+ * @hbClient ios numeric-dot \>= 1.3.396
140
140
  * @hbClient ohos none
141
141
  * @hbClient windows none
142
142
  * @hbClient macos none