@heybox/hb-sdk 0.6.2 → 0.6.4-alpha.0

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/README.md +5 -3
  2. package/dist/cli-chunks/{context-DmxbC_iV.cjs → context-BCwksd8H.cjs} +1 -37
  3. package/dist/cli-chunks/{create-CXBnqr5r.cjs → create-BO8GHVi0.cjs} +1 -1
  4. package/dist/cli-chunks/{dev-OCij_ecL.cjs → dev-DmgKnEC2.cjs} +59 -133
  5. package/dist/cli-chunks/{doctor-DQIzL_3_.cjs → doctor-BlKB4f78.cjs} +1 -1
  6. package/dist/cli-chunks/{index-Ulhxo0YK.cjs → index-PxkpQ5of.cjs} +2 -2
  7. package/dist/cli-chunks/{index-CTyguEza.cjs → index-Q0G1SsEs.cjs} +13 -13
  8. package/dist/cli-chunks/{login-BWN2-2Gk.cjs → login-Cxdo4B6Z.cjs} +2 -2
  9. package/dist/cli-chunks/{remote-DxKtJ21x.cjs → remote-C1Rsb1dx.cjs} +5 -5
  10. package/dist/cli-chunks/{session-D7mPwyx4.cjs → session-CC3Oz3Xc.cjs} +1 -2
  11. package/dist/cli.cjs +1 -1
  12. package/dist/devtools/mock-host/index.html +54 -1
  13. package/dist/devtools/mock-host/main.js +196 -6
  14. package/dist/index.cjs.js +1 -1
  15. package/dist/index.esm.js +1 -1
  16. package/dist/miniapp-publish.cjs.js +0 -4
  17. package/dist/miniapp-publish.esm.js +1 -4
  18. package/dist/vite.cjs.js +2 -344
  19. package/dist/vite.esm.js +2 -344
  20. package/package.json +2 -2
  21. package/skill/SKILL.md +5 -3
  22. package/skill/references/api-root.md +6 -26
  23. package/skill/references/cli.md +7 -5
  24. package/skill/skill.json +4 -4
  25. package/types/miniapp-publish/index.d.ts +0 -1
  26. package/types/vite/index.d.ts +1 -7
  27. package/types/cli/auth/base-url.d.ts +0 -20
  28. package/types/cli/config.d.ts +0 -11
  29. package/types/miniapp-manifest/sdk-version-policy.d.ts +0 -9
  30. package/types/vite/sdk-version-gate.d.ts +0 -8
package/dist/vite.esm.js CHANGED
@@ -1,17 +1,10 @@
1
1
  import { readFileSync, existsSync, writeFileSync, mkdirSync, readdirSync } from 'node:fs';
2
2
  import path from 'node:path';
3
- import require$$0 from 'path';
4
- import require$$1 from 'os';
5
- import { readFile, mkdir, writeFile, rename } from 'node:fs/promises';
6
3
 
7
4
  /** 构建时替换为当前发布包的实际版本。 */
8
5
  const HB_SDK_VERSION = typeof undefined === 'string'
9
6
  ? undefined
10
- : '0.6.2';
11
-
12
- function getDefaultExportFromCjs (x) {
13
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
14
- }
7
+ : '0.6.4-alpha.0';
15
8
 
16
9
  var re = {exports: {}};
17
10
 
@@ -11584,328 +11577,9 @@ function walk(node, visit) {
11584
11577
  walk(node.content, visit);
11585
11578
  }
11586
11579
 
11587
- var envPaths$1 = {exports: {}};
11588
-
11589
- var hasRequiredEnvPaths;
11590
-
11591
- function requireEnvPaths () {
11592
- if (hasRequiredEnvPaths) return envPaths$1.exports;
11593
- hasRequiredEnvPaths = 1;
11594
- const path = require$$0;
11595
- const os = require$$1;
11596
-
11597
- const homedir = os.homedir();
11598
- const tmpdir = os.tmpdir();
11599
- const {env} = process;
11600
-
11601
- const macos = name => {
11602
- const library = path.join(homedir, 'Library');
11603
-
11604
- return {
11605
- data: path.join(library, 'Application Support', name),
11606
- config: path.join(library, 'Preferences', name),
11607
- cache: path.join(library, 'Caches', name),
11608
- log: path.join(library, 'Logs', name),
11609
- temp: path.join(tmpdir, name)
11610
- };
11611
- };
11612
-
11613
- const windows = name => {
11614
- const appData = env.APPDATA || path.join(homedir, 'AppData', 'Roaming');
11615
- const localAppData = env.LOCALAPPDATA || path.join(homedir, 'AppData', 'Local');
11616
-
11617
- return {
11618
- // Data/config/cache/log are invented by me as Windows isn't opinionated about this
11619
- data: path.join(localAppData, name, 'Data'),
11620
- config: path.join(appData, name, 'Config'),
11621
- cache: path.join(localAppData, name, 'Cache'),
11622
- log: path.join(localAppData, name, 'Log'),
11623
- temp: path.join(tmpdir, name)
11624
- };
11625
- };
11626
-
11627
- // https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
11628
- const linux = name => {
11629
- const username = path.basename(homedir);
11630
-
11631
- return {
11632
- data: path.join(env.XDG_DATA_HOME || path.join(homedir, '.local', 'share'), name),
11633
- config: path.join(env.XDG_CONFIG_HOME || path.join(homedir, '.config'), name),
11634
- cache: path.join(env.XDG_CACHE_HOME || path.join(homedir, '.cache'), name),
11635
- // https://wiki.debian.org/XDGBaseDirectorySpecification#state
11636
- log: path.join(env.XDG_STATE_HOME || path.join(homedir, '.local', 'state'), name),
11637
- temp: path.join(tmpdir, username, name)
11638
- };
11639
- };
11640
-
11641
- const envPaths = (name, options) => {
11642
- if (typeof name !== 'string') {
11643
- throw new TypeError(`Expected string, got ${typeof name}`);
11644
- }
11645
-
11646
- options = Object.assign({suffix: 'nodejs'}, options);
11647
-
11648
- if (options.suffix) {
11649
- // Add suffix to prevent possible conflict with native apps
11650
- name += `-${options.suffix}`;
11651
- }
11652
-
11653
- if (process.platform === 'darwin') {
11654
- return macos(name);
11655
- }
11656
-
11657
- if (process.platform === 'win32') {
11658
- return windows(name);
11659
- }
11660
-
11661
- return linux(name);
11662
- };
11663
-
11664
- envPaths$1.exports = envPaths;
11665
- // TODO: Remove this for the next major release
11666
- envPaths$1.exports.default = envPaths;
11667
- return envPaths$1.exports;
11668
- }
11669
-
11670
- var envPathsExports = requireEnvPaths();
11671
- var envPaths = /*@__PURE__*/getDefaultExportFromCjs(envPathsExports);
11672
-
11673
- const APIUserMiniprogramPublicSdkConfigPath = '/user_miniprogram/public/sdk_config';
11674
- function createUserMiniprogramPublicSdkConfigRequest(serviceTag) {
11675
- return {
11676
- path: APIUserMiniprogramPublicSdkConfigPath,
11677
- searchParams: serviceTag ? { special_tag: serviceTag } : {},
11678
- headers: serviceTag ? { 'x-rylai-service-tag': serviceTag } : {},
11679
- };
11680
- }
11681
- function parseUserMiniprogramPublicSdkConfigResult(value) {
11682
- if (!isRecord(value) ||
11683
- typeof value.minimum_sdk_version !== 'string') {
11684
- throw new Error('公共 SDK 配置响应无效');
11685
- }
11686
- return value;
11687
- }
11688
- function parseUserMiniprogramPublicSdkConfigEnvelope(value) {
11689
- if (!isRecord(value) || value.status !== 'ok') {
11690
- throw new Error('公共 SDK 配置响应无效');
11691
- }
11692
- return parseUserMiniprogramPublicSdkConfigResult(value.result);
11693
- }
11694
- function isRecord(value) {
11695
- return typeof value === 'object' && value !== null;
11696
- }
11697
-
11698
- const PUBLIC_USER_MINIPROGRAM_SDK_CONFIG_API_PATH = APIUserMiniprogramPublicSdkConfigPath;
11699
-
11700
- const CACHE_MAX_AGE_MS = 24 * 60 * 60 * 1_000;
11701
- const CACHE_FILE_NAME = 'minimum-sdk-versions.json';
11702
- async function resolveMinimumSdkVersion(options) {
11703
- const now = options.now ?? Date.now();
11704
- const cachePath = path.join(options.cacheDir, CACHE_FILE_NAME);
11705
- const cache = await readCache(cachePath);
11706
- let minimumSdkVersion;
11707
- try {
11708
- minimumSdkVersion = validateStableSdkVersion(await options.fetchMinimumSdkVersion(), 'minimumSdkVersion');
11709
- }
11710
- catch {
11711
- const cached = cache.environments[options.environment];
11712
- const cacheAge = cached ? now - cached.fetchedAt : Number.NaN;
11713
- if (cached && Number.isFinite(cached.fetchedAt) && cacheAge >= 0 && cacheAge <= CACHE_MAX_AGE_MS) {
11714
- try {
11715
- return validateStableSdkVersion(cached.minimumSdkVersion, 'cached minimumSdkVersion');
11716
- }
11717
- catch {
11718
- // 非法缓存按不存在处理。
11719
- }
11720
- }
11721
- throw new Error('MINIMUM_SDK_VERSION_UNAVAILABLE:无法获取最低 SDK 版本,且没有 24 小时内的有效缓存');
11722
- }
11723
- cache.environments[options.environment] = { fetchedAt: now, minimumSdkVersion };
11724
- try {
11725
- await writeCache(cachePath, cache);
11726
- }
11727
- catch {
11728
- // 已校验的远端策略仍然可信;缓存只是离线回退优化。
11729
- }
11730
- return minimumSdkVersion;
11731
- }
11732
- function validateCurrentSdkVersion(currentSdkVersion, minimumSdkVersion, options) {
11733
- const current = validateSdkVersion(currentSdkVersion, '当前 SDK 版本');
11734
- const minimum = validateStableSdkVersion(minimumSdkVersion, 'minimumSdkVersion');
11735
- if (!options.allowPrerelease && semverExports.prerelease(current) !== null) {
11736
- throw new Error('正式发布不允许使用预发布 SDK,请运行 pnpm add @heybox/hb-sdk@latest 后重新构建');
11737
- }
11738
- if (!semverExports.satisfies(current, `>=${minimum}`, { includePrerelease: options.allowPrerelease })) {
11739
- throw new Error(`SDK_VERSION_TOO_LOW:当前 @heybox/hb-sdk@${current} 低于最低版本 ${minimum},请运行 pnpm add @heybox/hb-sdk@latest`);
11740
- }
11741
- return current;
11742
- }
11743
- function validateSdkVersion(value, label) {
11744
- const normalized = String(value).trim();
11745
- const parsed = semverExports.parse(normalized);
11746
- if (!parsed || parsed.version !== normalized || parsed.build.length > 0) {
11747
- throw new Error(`${label} 必须是合法 SemVer:${normalized}`);
11748
- }
11749
- return normalized;
11750
- }
11751
- function validateStableSdkVersion(value, label) {
11752
- const normalized = validateSdkVersion(value, label);
11753
- if (semverExports.prerelease(normalized) !== null)
11754
- throw new Error(`${label} 必须是稳定 SemVer:${normalized}`);
11755
- return normalized;
11756
- }
11757
- async function readCache(cachePath) {
11758
- try {
11759
- const parsed = JSON.parse(await readFile(cachePath, 'utf8'));
11760
- if (parsed && typeof parsed === 'object' && parsed.environments && typeof parsed.environments === 'object')
11761
- return parsed;
11762
- }
11763
- catch {
11764
- // 缓存缺失或损坏时继续请求最新配置。
11765
- }
11766
- return { environments: {} };
11767
- }
11768
- async function writeCache(cachePath, cache) {
11769
- await mkdir(path.dirname(cachePath), { recursive: true });
11770
- const temporaryPath = `${cachePath}.${process.pid}.tmp`;
11771
- await writeFile(temporaryPath, `${JSON.stringify(cache, null, 2)}\n`, { mode: 0o600 });
11772
- await rename(temporaryPath, cachePath);
11773
- }
11774
-
11775
- const globalHeyboxCliRequestConfig = {};
11776
- function readHeyboxCliRequestConfig() {
11777
- return normalizeHeyboxRylaiServiceTagConfig(globalHeyboxCliRequestConfig);
11778
- }
11779
- function resolveHeyboxRylaiServiceTag(pathWithQuery, config = readHeyboxCliRequestConfig()) {
11780
- const normalized = normalizeHeyboxRylaiServiceTagConfig(config);
11781
- const pathname = getPathname(pathWithQuery) ;
11782
- const specialTag = normalized.special_tag;
11783
- if (pathname && specialTag?.path_prefix_list.some((prefix) => pathname.startsWith(prefix))) {
11784
- return specialTag.tag_name;
11785
- }
11786
- return normalized.default_tag;
11787
- }
11788
- function normalizeHeyboxRylaiServiceTagConfig(config) {
11789
- const defaultTag = normalizeHeyboxRylaiServiceTag(config.default_tag);
11790
- const specialTagName = normalizeHeyboxRylaiServiceTag(config.special_tag?.tag_name);
11791
- const pathPrefixList = config.special_tag?.path_prefix_list?.filter(isValidPathPrefix) || [];
11792
- return {
11793
- ...(defaultTag ? { default_tag: defaultTag } : {}),
11794
- ...(specialTagName && pathPrefixList.length
11795
- ? {
11796
- special_tag: {
11797
- tag_name: specialTagName,
11798
- path_prefix_list: pathPrefixList,
11799
- },
11800
- }
11801
- : {}),
11802
- };
11803
- }
11804
- function normalizeHeyboxRylaiServiceTag(value) {
11805
- const tag = String(value ?? '').trim();
11806
- if (!tag) {
11807
- return undefined;
11808
- }
11809
- if (/[\r\n]/.test(tag)) {
11810
- throw new Error('x-rylai-service-tag 不允许包含换行符');
11811
- }
11812
- return tag;
11813
- }
11814
- function isValidPathPrefix(value) {
11815
- return typeof value === 'string' && value.startsWith('/') && !/[\r\n]/.test(value);
11816
- }
11817
- function getPathname(pathWithQuery) {
11818
- try {
11819
- return new URL(pathWithQuery, 'https://api.xiaoheihe.cn').pathname;
11820
- }
11821
- catch {
11822
- return '';
11823
- }
11824
- }
11825
-
11826
- const paths = envPaths('hb-sdk');
11827
- async function enforceViteSdkVersion(options) {
11828
- const fetchImpl = options.fetchImpl ?? fetch;
11829
- const serviceTag = resolveHeyboxRylaiServiceTag(PUBLIC_USER_MINIPROGRAM_SDK_CONFIG_API_PATH, {
11830
- default_tag: options.serviceTag,
11831
- });
11832
- const minimumSdkVersion = await resolveMinimumSdkVersion({
11833
- cacheDir: options.cacheDir ?? paths.cache,
11834
- environment: options.environment,
11835
- fetchMinimumSdkVersion: async () => {
11836
- const request = createUserMiniprogramPublicSdkConfigRequest(serviceTag);
11837
- const url = new URL(request.path, options.environment);
11838
- for (const [key, value] of Object.entries(request.searchParams)) {
11839
- url.searchParams.set(key, value);
11840
- }
11841
- const response = await fetchImpl(url, {
11842
- headers: request.headers,
11843
- });
11844
- if (!response.ok) {
11845
- throw new Error('公共 SDK 配置响应无效');
11846
- }
11847
- return parseUserMiniprogramPublicSdkConfigEnvelope(await response.json())
11848
- .minimum_sdk_version;
11849
- },
11850
- });
11851
- return validateCurrentSdkVersion(options.sdkVersion, minimumSdkVersion, { allowPrerelease: options.allowPrerelease });
11852
- }
11853
-
11854
- const HEYBOX_API_BASE_URL = 'https://api.xiaoheihe.cn';
11855
- const TRUSTED_HEYBOX_API_HOST_SUFFIXES = ['.xiaoheihe.cn', '.debugmode.cn'];
11856
- function resolveHeyboxApiBaseUrl(options = {}) {
11857
- const env = options.env;
11858
- const baseUrl = normalizeHeyboxOriginUrl(options.apiBaseUrl ?? env?.HB_SDK_API_BASE_URL ?? HEYBOX_API_BASE_URL, 'Heybox API baseUrl');
11859
- assertSafeHeyboxApiBaseUrl(baseUrl, {
11860
- allowUnsafeApiBaseUrl: options.allowUnsafeApiBaseUrl === true || isTruthyEnvFlag(env?.HB_SDK_ALLOW_UNSAFE_API_BASE_URL),
11861
- });
11862
- return baseUrl;
11863
- }
11864
- function normalizeHeyboxOriginUrl(value, label) {
11865
- const raw = String(value ?? '').trim();
11866
- if (!raw) {
11867
- throw new Error(`${label} 不能为空`);
11868
- }
11869
- let url;
11870
- try {
11871
- url = new URL(raw);
11872
- }
11873
- catch {
11874
- throw new Error(`${label} 必须是合法的 http(s) origin:${raw}`);
11875
- }
11876
- if (url.protocol !== 'http:' && url.protocol !== 'https:') {
11877
- throw new Error(`${label} 只支持 http(s) 协议:${raw}`);
11878
- }
11879
- if (url.username || url.password) {
11880
- throw new Error(`${label} 不允许包含用户名或密码:${raw}`);
11881
- }
11882
- const rawSuffix = raw.match(/^[a-z][a-z\d+.-]*:\/\/[^/?#]+(.*)$/i)?.[1] ?? '';
11883
- if ((rawSuffix && rawSuffix !== '/') || url.search || url.hash) {
11884
- throw new Error(`${label} 只支持 origin,不允许包含 path、query 或 hash:${raw}`);
11885
- }
11886
- return url.origin;
11887
- }
11888
- function assertSafeHeyboxApiBaseUrl(origin, options) {
11889
- if (options.allowUnsafeApiBaseUrl) {
11890
- return;
11891
- }
11892
- const url = new URL(origin);
11893
- if (url.protocol !== 'https:' || !isTrustedHeyboxApiHost(url.hostname)) {
11894
- throw new Error('Heybox API baseUrl 默认只允许 Heybox 受信 HTTPS origin;本地调试请显式使用 --allow-unsafe-api-base-url 或 HB_SDK_ALLOW_UNSAFE_API_BASE_URL=1');
11895
- }
11896
- }
11897
- function isTrustedHeyboxApiHost(hostname) {
11898
- return TRUSTED_HEYBOX_API_HOST_SUFFIXES.some((suffix) => hostname === suffix.slice(1) || hostname.endsWith(suffix));
11899
- }
11900
- function isTruthyEnvFlag(value) {
11901
- return ['1', 'true', 'yes', 'on'].includes(String(value ?? '')
11902
- .trim()
11903
- .toLowerCase());
11904
- }
11905
-
11906
11580
  const sdkVersionPlaceholder = ['__HB_SDK', 'VERSION__'].join('_');
11907
11581
  const sdkVersionBuildConstant = ['__HB_SDK_BUILD', 'VERSION__'].join('_');
11908
- function miniappManifest(options = {}) {
11582
+ function miniappManifest() {
11909
11583
  let root = process.cwd();
11910
11584
  let outDir = 'dist';
11911
11585
  let command = 'build';
@@ -11929,22 +11603,6 @@ function miniappManifest(options = {}) {
11929
11603
  command = resolved.command;
11930
11604
  hmrWebSocketUrl = resolveHmrWebSocketUrl(resolved);
11931
11605
  },
11932
- async buildStart() {
11933
- if (command !== 'build' || process.env.HB_SDK_DEPLOY_BUILD === '1')
11934
- return;
11935
- try {
11936
- await (options.enforceSdkVersion ?? enforceViteSdkVersion)({
11937
- sdkVersion: resolveSdkVersion(),
11938
- environment: resolveHeyboxApiBaseUrl({ env: process.env }),
11939
- serviceTag: process.env.HB_SDK_SERVICE_TAG,
11940
- allowPrerelease: true,
11941
- });
11942
- }
11943
- catch (error) {
11944
- priorBuildError = toError(error);
11945
- throw priorBuildError;
11946
- }
11947
- },
11948
11606
  buildEnd(error) {
11949
11607
  if (error) {
11950
11608
  priorBuildError = priorBuildError ?? toError(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heybox/hb-sdk",
3
- "version": "0.6.2",
3
+ "version": "0.6.4-alpha.0",
4
4
  "sideEffects": [
5
5
  "./src/index.ts",
6
6
  "./src/core/singleton.ts",
@@ -92,7 +92,7 @@
92
92
  "vue": "^2.7.16",
93
93
  "vite": "^8.0.12",
94
94
  "vitest": "^3.2.4",
95
- "@heybox/hb-api": "~1.25.1"
95
+ "@heybox/hb-api": "~1.25.3"
96
96
  },
97
97
  "publishConfig": {
98
98
  "registry": "https://registry.npmjs.org/",
package/skill/SKILL.md CHANGED
@@ -49,7 +49,7 @@ Apply these instructions when writing, reviewing, or debugging code that consume
49
49
  ## Step 5: Use CLI workflows
50
50
 
51
51
  1. Use `hb-sdk create <project-name>` to scaffold a standalone external mini-program template.
52
- 2. Use `hb-sdk dev` for local browser debugging through the built-in mock runtime host. The project must bind `package.json.heybox.miniProgramId` and the CLI must be logged in so dev can load the real Runtime permission snapshot before starting Vite.
52
+ 2. Use `hb-sdk dev` for local browser, Mac App, or mobile App debugging through the built-in mock runtime host. Vite and native dev-shell entrypoints only require the local `mini_url`: a missing project binding, CLI login, remote dev-context failure, or the 3-second context timeout must fall back to an anonymous local sandbox instead of blocking startup. Anonymous mode denies managed capabilities by default. When a verified remote dev context is available, the Mock Host uses its Runtime permission snapshot as the initial local simulation and reports local-versus-online permission differences.
53
53
  3. Use `hb-sdk remote ...` for developer-owned remote mini-program management. Top-level `hb-sdk deploy` has been hard-cut and must not be recommended as a compatibility alias.
54
54
  4. Use `hb-sdk remote entity list`, `hb-sdk remote entity current`, and `hb-sdk remote entity switch <entity-id>` to inspect or change the developer platform server-side current entity before remote management commands.
55
55
  5. Use `hb-sdk remote create` to create a remote mini-program under the server-side current entity and bind the returned id into `package.json.heybox.miniProgramId`; use `hb-sdk remote bind <mini-program-id>` to bind an existing remote mini-program after current-entity manageability is verified. CLI project configuration contains only `package.json.heybox.miniProgramId`; mini-program name, icon, and cover images are maintained on the Open platform version-publish flow. On first submit without prior approved profile, the server injects a default name and default images.
@@ -59,12 +59,12 @@ Apply these instructions when writing, reviewing, or debugging code that consume
59
59
  9. Always provide a concise release note before deploy. Non-interactive environments must pass `--release-note`; interactive terminals may prompt for it. The default is manual release after approval with `hb-sdk remote release <version>`; use `--auto-publish` when the audited version should automatically release after approval.
60
60
  10. Use `hb-sdk remote release <version>`, `hb-sdk remote withdraw <version>`, `hb-sdk remote take-down`, and `hb-sdk remote reopen` for dangerous remote changes. Interactive terminals should confirm after showing enough context; non-interactive environments must pass `--yes`.
61
61
  11. For internal test/staging backend operations, use origin-only custom URLs: `HB_SDK_API_BASE_URL` or `hb-sdk remote ... --api-base-url <url>` for remote platform APIs, and `HB_SDK_LOGIN_BASE_URL` or `hb-sdk login --login-base-url <url>` for browser login. CLI flags override env vars. API base URLs must be Heybox trusted HTTPS origins by default; use `--allow-unsafe-api-base-url` or `HB_SDK_ALLOW_UNSAFE_API_BASE_URL=1` only for local backend debugging. Do not include path, query, or hash in these URLs.
62
- 12. For development routing or gray validation, use `HB_SDK_SERVICE_TAG` to attach `x-rylai-service-tag` and the matching `special_tag` query parameter to CLI backend requests and the Vite minimum-SDK-version gate used by manual builds. Deploy builds skip that client-side version gate. Repository-local path-specific routing can still be configured in `packages/hb-sdk/src/cli/config.ts` with `@heybox/hb-types` `RylaiServiceTagConfig` (`default_tag` / path-specific `special_tag`).
62
+ 12. For development routing or gray validation, use `HB_SDK_SERVICE_TAG` to attach `x-rylai-service-tag` and the matching `special_tag` query parameter to CLI backend requests. Repository-local path-specific routing can still be configured in `packages/hb-sdk/src/cli/config.ts` with `@heybox/hb-types` `RylaiServiceTagConfig` (`default_tag` / path-specific `special_tag`).
63
63
  13. If a remote command targets a custom login environment, pass the same `--login-base-url` or `HB_SDK_LOGIN_BASE_URL` used for `hb-sdk login`; remote commands reject cached CLI login state from a different login origin.
64
64
  14. Add `--verbose` / `-v` only when diagnosing failures; default CLI errors are intentionally concise, while verbose output includes backend envelope, HTTP status, trace fields, raw body, or original submit-audit failure details.
65
65
  15. Use `--json` for script consumption of `hb-sdk remote` commands. With `--json`, stdout must contain exactly one JSON object; progress, warnings, update reminders, and verbose diagnostics must not pollute stdout.
66
66
  16. Do not expect custom base URLs to affect `hb-sdk doctor`, npm latest checks, or mock-host `network.request()`.
67
- 17. Use the Mock runtime host's "在 Mac 版 APP 中启动" button for Mac App debugging, or the "Mobile App" QR code after selecting a LAN interface for phone App debugging; the phone must be on the same LAN and use a Heybox App version that supports the mini-program dev shell.
67
+ 17. Use the Mock runtime host's "在 Mac 版 APP 中启动" button for Mac App debugging, or the "Mobile App" QR code after selecting a LAN interface for phone App debugging; these entrypoints remain available in anonymous mode. The phone must be on the same LAN and use a Heybox App version that supports the mini-program dev shell.
68
68
  18. Use `--port`, `--mock-port`, and `--no-open` when the default Vite/mock ports or browser opening behavior need to be controlled.
69
69
  19. Use `hb-sdk login`, `hb-sdk login status`, and `hb-sdk login clear` only for the CLI's own Heybox auth cache. Keep `hb-sdk login` top-level; it is not a remote mini-program command.
70
70
  20. Treat `selectedEntity` in the CLI auth cache as a non-authoritative hint snapshot only. Every remote command must use the server-side current entity as the source of truth.
@@ -93,6 +93,8 @@ For CLI and local development:
93
93
  2. Do not use `hb-sdk login` as a workaround for iframe SDK authentication.
94
94
  3. Do not bypass `hb-sdk dev` by adding a second browser mock host.
95
95
  4. Keep the Vite `miniappManifest()` plugin enabled so builds only start in a compatible APP Runtime. Normal deploy always runs the project build.
96
+ 5. Keep Mock Host permission overrides in devtools-only memory. They must not rebuild the iframe, interrupt Vite HMR, mutate online permissions, or be passed through URL query parameters.
97
+ 6. Treat remote dev context as optional diagnostics and initialization data. Do not use a public mini-program detail request as a dev startup gate.
96
98
 
97
99
  For host/runtime/protocol-maintenance code:
98
100
 
@@ -19,7 +19,7 @@
19
19
  ## Package metadata
20
20
 
21
21
  - Package: `@heybox/hb-sdk`
22
- - Version at generation time: `0.6.2`
22
+ - Version at generation time: `0.6.4-alpha.0`
23
23
  - Public root export: `@heybox/hb-sdk`
24
24
  - Protocol export: `@heybox/hb-sdk/protocol`
25
25
  - Vite plugin export: `@heybox/hb-sdk/vite`
@@ -203,25 +203,17 @@ import { HB_SDK_VERSION } from '../core/version';
203
203
  import { renderMiniappManifest, validateMiniappPackageVersionForBuild } from '../miniapp-manifest/schema';
204
204
  import { readMiniappVersionFromPackageJson } from '../miniapp-manifest/node';
205
205
  import { enforceMiniappHtmlPolicy } from './html-policy';
206
- import { enforceViteSdkVersion as defaultEnforceRemoteSdkVersion } from './sdk-version-gate';
207
- import { resolveHeyboxApiBaseUrl } from '../cli/auth/base-url';
208
206
 
209
207
  type MiniappManifestPlugin = {
210
208
  name: string;
211
209
  config: (config: MiniappManifestUserConfig) => MiniappManifestUserConfig | void;
212
210
  configResolved: (resolved: MiniappManifestResolvedConfig) => void;
213
- buildStart: () => Promise<void>;
214
211
  /** Rollup 在构建失败后仍会跑 closeBundle;用 buildEnd 记录真实错误,避免二次校验掩盖原因。 */
215
212
  buildEnd: (error?: Error) => void;
216
213
  transformIndexHtml: (html: string) => string;
217
214
  closeBundle: (this: MiniappManifestPluginContext) => Promise<void>;
218
215
  };
219
216
 
220
- export interface MiniappManifestOptions {
221
- /** 仅供平台测试和自托管 Remote Environment adapter 使用。 */
222
- enforceSdkVersion?: typeof defaultEnforceRemoteSdkVersion;
223
- }
224
-
225
217
  interface MiniappManifestUserConfig {
226
218
  base?: string;
227
219
  define?: Record<string, string>;
@@ -254,7 +246,7 @@ interface MiniappManifestResolvedConfig {
254
246
  const sdkVersionPlaceholder = ['__HB_SDK', 'VERSION__'].join('_');
255
247
  const sdkVersionBuildConstant = ['__HB_SDK_BUILD', 'VERSION__'].join('_');
256
248
 
257
- export function miniappManifest(options: MiniappManifestOptions = {}): MiniappManifestPlugin {
249
+ export function miniappManifest(): MiniappManifestPlugin {
258
250
  let root = process.cwd();
259
251
  let outDir = 'dist';
260
252
  let command: 'build' | 'serve' = 'build';
@@ -279,20 +271,6 @@ export function miniappManifest(options: MiniappManifestOptions = {}): MiniappMa
279
271
  command = resolved.command;
280
272
  hmrWebSocketUrl = resolveHmrWebSocketUrl(resolved);
281
273
  },
282
- async buildStart() {
283
- if (command !== 'build' || process.env.HB_SDK_DEPLOY_BUILD === '1') return;
284
- try {
285
- await (options.enforceSdkVersion ?? defaultEnforceRemoteSdkVersion)({
286
- sdkVersion: resolveSdkVersion(),
287
- environment: resolveHeyboxApiBaseUrl({ env: process.env }),
288
- serviceTag: process.env.HB_SDK_SERVICE_TAG,
289
- allowPrerelease: true,
290
- });
291
- } catch (error) {
292
- priorBuildError = toError(error);
293
- throw priorBuildError;
294
- }
295
- },
296
274
  buildEnd(error) {
297
275
  if (error) {
298
276
  priorBuildError = priorBuildError ?? toError(error);
@@ -404,7 +382,7 @@ export default defineConfig({
404
382
 
405
383
  插件只接受单页应用:输出目录只能存在入口 `index.html`。build 会用结构化 HTML parser 校验入口,并把平台 CSP 插入 `<head>` 首位;已有 CSP 会原样保留,两份策略按浏览器交集生效。正式策略禁止 `fetch`、XHR、WebSocket、EventSource、Beacon、Worker、iframe、表单和对象加载等浏览器原生出口;业务网络请求应使用 `network.request()`。dev 使用相同策略,只额外放行当前 Vite 的精确 HMR WebSocket 地址。
406
384
 
407
- meta refresh、外部 anchor、`dns-prefetch`、`preconnect`、`prerender`、外部资源 URL 和额外 HTML 会使 build 失败。内联 script/style 允许,但 `unsafe-eval` 不允许。`dev` 和手动 Vite build 会读取 `/user_miniprogram/public/sdk_config` `minimumSdkVersion`;最新请求失败时只回退当前 Remote Environment 下 24 小时内的有效缓存,无缓存则默认阻断并提示升级 `@heybox/hb-sdk@latest`。`hb-sdk remote deploy`(包括 `--from-version`)不执行客户端最低版本查询或比较,但仍校验 Manifest 结构并经过服务端 precheck / submit-audit 策略。
385
+ meta refresh、外部 anchor、`dns-prefetch`、`preconnect`、`prerender`、外部资源 URL 和额外 HTML 会使 build 失败。内联 script/style 允许,但 `unsafe-eval` 不允许。`dev` 和手动 Vite build 不再请求远端最低 SDK 版本;构建仍会把当前 `sdkVersion` 写入 Manifest,`hb-sdk remote deploy` 仍校验 Manifest 结构并经过服务端 precheck / submit-audit 策略。
408
386
 
409
387
  失败与警告语义:
410
388
 
@@ -472,7 +450,9 @@ SDK 需要在黑盒小程序 iframe 容器内运行。父容器会为页面注
472
450
  npm run dev
473
451
  ```
474
452
 
475
- 调试页会通过 iframe 加载本地页面并补齐小程序 bridge 环境;浏览器 Mock mock host 的同源只读 bootstrap 接口读取服务端保留的 Runtime 权限快照,URL query 不能提供或覆盖权限。项目已绑定 `heybox.miniProgramId` 时,可以点击调试页里的「在 Mac APP 中启动」按钮,或在「Mobile App」区域选择局域网网卡后用手机小黑盒 APP 扫码;真机 dev shell 只携带绑定的小程序 ID 和本地页面地址,H5 宿主按 ID 从公开详情接口读取可信 Runtime 权限快照。项目未绑定时仍可使用默认拒绝受管能力的浏览器 Mock,但 Mac 和手机真机入口会明确提示先运行 `hb-sdk remote create` 或 `hb-sdk remote bind <mini-program-id>`,并保持不可用。真实容器加载开发 `mini_url` 前会提示“即将打开未经验证的开发网页。该页面可能由本机或局域网服务提供,请确认来源可信后继续。”,用户确认后才继续加载。Codex、VSCode 等内嵌浏览器可能无法唤起系统 APP;遇到这种情况时,请在系统浏览器中打开同一个调试页后重试。
453
+ 调试页会通过 iframe 加载本地页面并补齐小程序 bridge 环境。`hb-sdk dev` 的基础启动只依赖本地页面地址:即使项目未绑定、CLI 未登录或远端暂时不可用,浏览器 Mock、Mac 启动协议和手机二维码也会继续生成,真机 dev shell 以匿名本地沙箱加载 `mini_url`,不会把公开 `detail` 查询作为启动门禁。项目已绑定时会限时 3 秒读取远端 dev context;成功后 Mock Host 用真实 Runtime 权限快照初始化本地模拟,失败或超时则显示脱敏警告,并默认拒绝 `network.request` 等受管能力。
454
+
455
+ Mock Host 可以在内存中调整 devtools-only 权限模拟,不会重建 iframe,因此不影响 Vite HMR;本地设置不会修改线上权限。调试页会对比已读取的线上快照,提示本地放开但上线后会返回 `PERMISSION_DENIED` 的差异。权限快照只通过 mock host 的同源只读 bootstrap 接口传递,URL query 不能提供或覆盖权限。真实容器加载开发 `mini_url` 前会提示“即将打开未经验证的开发网页。该页面可能由本机或局域网服务提供,请确认来源可信后继续。”,用户确认后才继续加载。Codex、VSCode 等内嵌浏览器可能无法唤起系统 APP;遇到这种情况时,请在系统浏览器中打开同一个调试页后重试。
476
456
 
477
457
  在未使用脚手架的 Vite 项目中,可以把命令加到 `package.json`:
478
458
 
@@ -103,7 +103,7 @@ Agent rules:
103
103
  hb-sdk dev
104
104
  ```
105
105
 
106
- `hb-sdk dev` 会从当前目录向上查找最近的 `package.json`,并在项目已绑定且 CLI 已登录时尝试查询真实 Runtime 权限快照。项目未绑定、未登录或远端暂时不可用时,命令会输出警告并继续启动 Vite 和内置 mock runtime host;此时使用缺失权限快照,`network.request` 等受管能力默认拒绝。远端权限读取成功时,mock host 使用真实快照,远端明确关闭的能力仍稳定返回 `PERMISSION_DENIED`。本地 `package.json` 无法解析等配置错误不会被降级,命令会直接报错。调试页默认自动打开;需要真实黑盒小程序容器加载同一页面时,点击调试页里的「在 Mac 版 APP 中启动」按钮,或在「Mobile App」区域选择局域网网卡后用手机小黑盒 APP 扫码。
106
+ `hb-sdk dev` 会从当前目录向上查找最近的 `package.json`。Vite、内置 mock runtime host、Mac 启动协议和手机二维码的基础启动只依赖本地页面地址,不要求项目先绑定或 CLI 先登录。项目已绑定时,CLI 会限时 3 秒读取远端 dev context;成功后用真实 Runtime 权限快照初始化 Mock Host,失败或超时则输出脱敏警告并继续匿名调试,`network.request` 等受管能力默认拒绝。公开 `detail` 查询不再是 dev 启动门禁。本地 `package.json` 无法解析等配置错误不会被降级,命令会直接报错。调试页默认自动打开;需要真实黑盒小程序容器加载同一页面时,点击调试页里的「在 Mac 版 APP 中启动」按钮,或在「Mobile App」区域选择局域网网卡后用手机小黑盒 APP 扫码。
107
107
 
108
108
  常用参数:
109
109
 
@@ -116,11 +116,13 @@ hb-sdk dev
116
116
 
117
117
  ## Mock runtime 边界
118
118
 
119
- `hb-sdk dev` 会把实际小程序页面地址编码到 mock host 的 `mini_url` query 中,由 mock host iframe 加载页面并补齐小程序 bridge 环境;浏览器 Mock 的 Runtime 权限只从 mock host 同源只读 bootstrap 接口读取,URL query 不能提供或覆盖权限。项目已绑定时,Mac 协议和手机二维码会把 `package.json.heybox.miniProgramId` 与本地页面地址交给 dev shell;H5 宿主按该 ID 从公开详情接口读取可信 Runtime 权限快照。项目未绑定时仍可使用默认拒绝受管能力的浏览器 Mock,但 Mac 和手机真机入口会明确提示先运行 `hb-sdk remote create` `hb-sdk remote bind <mini-program-id>`,并保持不可用。mock host 内置登录/登出、`show`、`hide`、在 Mac 版 APP 中启动、手机扫码调试等调试入口,并通过同一份 devtools-only runtime adapter 处理 SDK 能力调用。真实 Mac / Mobile App dev shell 加载开发 `mini_url` 前会提示“即将打开未经验证的开发网页。该页面可能由本机或局域网服务提供,请确认来源可信后继续。”,用户确认后才继续加载。Codex、VSCode 等内嵌浏览器可能无法唤起系统 APP;遇到这种情况时,请在系统浏览器中打开同一个调试页后重试。
119
+ `hb-sdk dev` 会把实际小程序页面地址编码到 mock host 的 `mini_url` query 中,由 mock host iframe 加载页面并补齐小程序 bridge 环境。Mac 协议和手机二维码始终携带本地页面地址;远端 dev context 可用时还会携带已验证的小程序 ID,不可用时则进入匿名本地沙箱。真机 dev shell 不依赖公开 `detail` 查询完成启动。真实 Mac / Mobile App dev shell 加载开发 `mini_url` 前会提示“即将打开未经验证的开发网页。该页面可能由本机或局域网服务提供,请确认来源可信后继续。”,用户确认后才继续加载。Codex、VSCode 等内嵌浏览器可能无法唤起系统 APP;遇到这种情况时,请在系统浏览器中打开同一个调试页后重试。
120
120
 
121
121
  不要为了本地调试再创建独立 mock runtime 包。CLI、模板和 mock host 都归属 `@heybox/hb-sdk`。
122
122
 
123
- 本地 mock runtime 下已授权的 `network.request()` 会通过 `hb-sdk` 本地 mock network proxy 转发真实 HTTP(S) 请求,用于避免浏览器 CORS 影响本地调试。远端权限可用时 Mock Host 使用远端详情返回的同一份权限快照;不可用时使用缺失快照并默认拒绝受管能力。proxy 不会把黑盒客户端私有协议字段暴露给 iframe 业务代码。
123
+ 浏览器 Mock 的权限状态只存在于 Mock Host 内存中,URL query 不能提供或覆盖权限。远端 dev context 可用时,Mock Host 以线上快照作为初始值;不可用时匿名状态默认拒绝受管能力。开发者可以在调试页临时调整 `network.request` 和官方域名权限,变更只会重建 devtools-only mock runtime,不会重建 iframe 或中断 Vite HMR,也不会修改线上配置。调试页会对比线上快照并提示本地放开但上线后会返回 `PERMISSION_DENIED` 的差异。
124
+
125
+ 本地 mock runtime 下已授权的 `network.request()` 会通过 `hb-sdk` 本地 mock network proxy 转发真实 HTTP(S) 请求,用于避免浏览器 CORS 影响本地调试。proxy 不会把黑盒客户端私有协议字段暴露给 iframe 业务代码。CLI 登录态和远端 dev context 也不会注入 iframe。
124
126
 
125
127
  Use `hb-sdk dev` for local browser SDK debugging. Use the Mock runtime host's "在 Mac 版 APP 中启动" button for Mac App debugging, or the "Mobile App" QR code after selecting a LAN interface for phone App debugging. The phone must be on the same LAN and use a Heybox App version that supports the mini-program dev shell. If the mock host is open inside Codex, VSCode, or another embedded browser, ask the user to open the same debug page in the system browser before retrying because embedded browsers may block the `heybox://` protocol handoff.
126
128
 
@@ -165,11 +167,11 @@ HB_SDK_ALLOW_UNSAFE_API_BASE_URL=1 hb-sdk remote deploy --api-base-url http://12
165
167
 
166
168
  `manifest.json` 仅作为提交审核接口的 `manifest` 字段提交,不会上传到 CDN。Vite 项目通过 `miniappManifest()` 插件生成;CLI 不会自动注入插件,请在 `vite.config.ts` 中显式挂载。小程序构建产物需要使用相对资源路径;`hb-sdk create` 模板会显式配置 `base: './'`,未配置 `base` 的项目也会由 `miniappManifest()` 在 build 时默认补成 `./`。构建产物只能在兼容的小黑盒 Runtime 中启动,普通浏览器直接打开时不会执行标准业务脚本。
167
169
 
168
- `remote deploy` 的本地构建和 `--from-version` 路径都不执行客户端 `minimumSdkVersion` 查询或比较;Manifest 结构校验、版本 precheck 和服务端 submit-audit 策略仍然生效。开发者手动执行 Vite build 时仍会运行最低 SDK 版本门禁。
170
+ `dev`、手动 Vite build、`remote deploy` 的本地构建和 `--from-version` 路径都不执行客户端 `minimumSdkVersion` 查询或比较;Manifest 结构校验、版本 precheck 和服务端 submit-audit 策略仍然生效。
169
171
 
170
172
  默认发布策略是 `auto_publish=false`:运营审核通过后使用 `hb-sdk remote versions` 查看版本状态,再用 `hb-sdk remote release <version>` 发布。需要审核通过后自动发布并下架旧线上版本时,使用 `--auto-publish`。如需让指定用户预览未发布候选版本,使用 `hb-sdk remote allowlist add <heybox_id>` 管理预览白名单。
171
173
 
172
- 内部测试或预发环境可通过 `HB_SDK_API_BASE_URL` / `HB_SDK_LOGIN_BASE_URL` 设置默认后台环境,也可以用 `--api-base-url` / `--login-base-url` 覆盖单次命令。自定义地址只接受 origin,不允许包含 path、query 或 hash;API origin 默认还必须是 Heybox 受信 HTTPS 域名,只有本地联调等场景可显式使用 `--allow-unsafe-api-base-url` 或 `HB_SDK_ALLOW_UNSAFE_API_BASE_URL=1` 放开。`apiBaseUrl` 影响 `hb-sdk remote` 里的远端平台后台 API,包括预检、CDN 上传凭证/回调、提交审核、版本、发布、撤回、下架、重新上架、详情和白名单等调用;`loginBaseUrl` 用于 `hb-sdk login` 的登录入口,以及 remote 命令前校验当前 CLI 登录态是否属于同一个登录环境。开发环境如需给后台请求带 `x-rylai-service-tag` 和 `special_tag`,优先用 `--service-tag <tag>` 或 `HB_SDK_SERVICE_TAG`;手动 Vite build 的最低 SDK 版本门禁请求会同时携带该 header 和 query,deploy 子构建不执行该门禁。path-prefix 级 `special_tag` 仍可在 `packages/hb-sdk/src/cli/config.ts` 里按 `@heybox/hb-types` 的 `RylaiServiceTagConfig` 配置。日志只输出 origin,不输出带身份和签名参数的完整请求 URL。
174
+ 内部测试或预发环境可通过 `HB_SDK_API_BASE_URL` / `HB_SDK_LOGIN_BASE_URL` 设置默认后台环境,也可以用 `--api-base-url` / `--login-base-url` 覆盖单次命令。自定义地址只接受 origin,不允许包含 path、query 或 hash;API origin 默认还必须是 Heybox 受信 HTTPS 域名,只有本地联调等场景可显式使用 `--allow-unsafe-api-base-url` 或 `HB_SDK_ALLOW_UNSAFE_API_BASE_URL=1` 放开。`apiBaseUrl` 影响 `hb-sdk remote` 里的远端平台后台 API,包括预检、CDN 上传凭证/回调、提交审核、版本、发布、撤回、下架、重新上架、详情和白名单等调用;`loginBaseUrl` 用于 `hb-sdk login` 的登录入口,以及 remote 命令前校验当前 CLI 登录态是否属于同一个登录环境。开发环境如需给后台请求带 `x-rylai-service-tag` 和 `special_tag`,优先用 `--service-tag <tag>` 或 `HB_SDK_SERVICE_TAG`。path-prefix 级 `special_tag` 仍可在 `packages/hb-sdk/src/cli/config.ts` 里按 `@heybox/hb-types` 的 `RylaiServiceTagConfig` 配置。日志只输出 origin,不输出带身份和签名参数的完整请求 URL。
173
175
 
174
176
  `hb-sdk doctor`、npm latest 检查、mock host 的 `network.request()` 不受这些配置影响。
175
177
 
package/skill/skill.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "hb-sdk",
3
- "skillVersion": "0.6.2+skill.f2a041bb2256",
3
+ "skillVersion": "0.6.4-alpha.0+skill.20921fb44039",
4
4
  "sdk": {
5
5
  "package": "@heybox/hb-sdk",
6
- "version": "0.6.2",
7
- "compatibility": "0.6.2"
6
+ "version": "0.6.4-alpha.0",
7
+ "compatibility": "0.6.4-alpha.0"
8
8
  },
9
9
  "source": "https://open.xiaoheihe.cn/agent-skills/hb-sdk",
10
- "integrity": "sha256-f2a041bb22563610e0fcaa991e2e5a2a94c331a029aafe4535083ecf89a4a6b0"
10
+ "integrity": "sha256-20921fb44039d21908fb692fc7d593c1dbc3b4f5dfa8f36f24aa0258ce150d13"
11
11
  }
@@ -2,7 +2,6 @@ export declare const MINIAPP_UPLOAD_SCOPE = "activity";
2
2
  export declare const ACTIVITY_UPLOAD_KEY_MAX_LENGTH = 64;
3
3
  export declare const MINIAPP_UPLOAD_BATCH_SIZE = 50;
4
4
  export declare const MINIAPP_UPLOAD_TOTAL_SIZE_LIMIT_BYTES: number;
5
- export declare const PUBLIC_USER_MINIPROGRAM_SDK_CONFIG_API_PATH = "/user_miniprogram/public/sdk_config";
6
5
  export declare const USER_MINIPROGRAM_ACCESS_STATUS_API_PATH = "/mall/developer/user_miniprogram/access_status";
7
6
  export declare const DEVELOPER_ENTITY_LIST_API_PATH = "/mall/developer/entity/list";
8
7
  export declare const DEVELOPER_ENTITY_SWITCH_API_PATH = "/mall/developer/entity/switch";
@@ -1,18 +1,12 @@
1
- import { enforceViteSdkVersion as defaultEnforceRemoteSdkVersion } from './sdk-version-gate';
2
1
  type MiniappManifestPlugin = {
3
2
  name: string;
4
3
  config: (config: MiniappManifestUserConfig) => MiniappManifestUserConfig | void;
5
4
  configResolved: (resolved: MiniappManifestResolvedConfig) => void;
6
- buildStart: () => Promise<void>;
7
5
  /** Rollup 在构建失败后仍会跑 closeBundle;用 buildEnd 记录真实错误,避免二次校验掩盖原因。 */
8
6
  buildEnd: (error?: Error) => void;
9
7
  transformIndexHtml: (html: string) => string;
10
8
  closeBundle: (this: MiniappManifestPluginContext) => Promise<void>;
11
9
  };
12
- export interface MiniappManifestOptions {
13
- /** 仅供平台测试和自托管 Remote Environment adapter 使用。 */
14
- enforceSdkVersion?: typeof defaultEnforceRemoteSdkVersion;
15
- }
16
10
  interface MiniappManifestUserConfig {
17
11
  base?: string;
18
12
  define?: Record<string, string>;
@@ -37,5 +31,5 @@ interface MiniappManifestResolvedConfig {
37
31
  };
38
32
  };
39
33
  }
40
- export declare function miniappManifest(options?: MiniappManifestOptions): MiniappManifestPlugin;
34
+ export declare function miniappManifest(): MiniappManifestPlugin;
41
35
  export {};
@@ -1,20 +0,0 @@
1
- export interface HeyboxBaseUrlEnv extends NodeJS.ProcessEnv {
2
- HB_SDK_API_BASE_URL?: string;
3
- HB_SDK_ALLOW_UNSAFE_API_BASE_URL?: string;
4
- HB_SDK_LOGIN_BASE_URL?: string;
5
- }
6
- export interface HeyboxBaseUrlResolveOptions {
7
- env?: HeyboxBaseUrlEnv;
8
- }
9
- export interface HeyboxApiBaseUrlResolveOptions extends HeyboxBaseUrlResolveOptions {
10
- allowUnsafeApiBaseUrl?: boolean;
11
- apiBaseUrl?: string;
12
- }
13
- export interface HeyboxLoginBaseUrlResolveOptions extends HeyboxBaseUrlResolveOptions {
14
- loginBaseUrl?: string;
15
- }
16
- export declare const HEYBOX_API_BASE_URL = "https://api.xiaoheihe.cn";
17
- export declare const HEYBOX_LOGIN_BASE_URL = "https://login.xiaoheihe.cn";
18
- export declare function resolveHeyboxApiBaseUrl(options?: HeyboxApiBaseUrlResolveOptions): string;
19
- export declare function resolveHeyboxLoginBaseUrl(options?: HeyboxLoginBaseUrlResolveOptions): string;
20
- export declare function normalizeHeyboxOriginUrl(value: string, label: string): string;
@@ -1,11 +0,0 @@
1
- import type { RylaiServiceTagConfig } from '@heybox/hb-types';
2
- export type HeyboxCliRequestConfig = RylaiServiceTagConfig;
3
- export declare function configureHeyboxCliRequestConfig(config: HeyboxCliRequestConfig): void;
4
- export declare function readHeyboxCliRequestConfig(): HeyboxCliRequestConfig;
5
- /**
6
- * 当 tag 为非空字符串时,把它设为 CLI 全局 default_tag;为空时不改动现有配置,
7
- * 避免清掉 env 预设阶段已注入的值。
8
- */
9
- export declare function applyServiceTagIfNeeded(tag: unknown): void;
10
- export declare function resolveHeyboxRylaiServiceTag(pathWithQuery?: string, config?: RylaiServiceTagConfig): string | undefined;
11
- export declare function normalizeHeyboxRylaiServiceTagConfig(config: HeyboxCliRequestConfig): RylaiServiceTagConfig;