@huoye/app-ship 0.2.1 → 0.3.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.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,14 @@
1
+ import * as url from 'url';
2
+ import FormData from 'form-data';
3
+
4
+ interface ReleaseProgress {
5
+ phase: 'artifact_check' | 'credentials' | 'channel_upload' | 'channel_processing' | 'channel_complete' | 'channel_failed' | 'receipt_store';
6
+ platform?: string;
7
+ loaded?: number;
8
+ total?: number;
9
+ }
10
+ type ReleaseProgressObserver = (event: ReleaseProgress) => void;
11
+
1
12
  /**
2
13
  * 上传配置接口
3
14
  */ interface UploadConfig {
@@ -5,6 +16,8 @@
5
16
  appId?: string;
6
17
  /** 版本号 */
7
18
  version?: string;
19
+ /** 同次发行按 BCP-47 语言标识共用的说明正文;省略时沿用入口单语言说明。 */
20
+ releaseNotes?: Record<string, string>;
8
21
  /** 构建相关配置 */
9
22
  build?: {
10
23
  /** Android 构建配置 */
@@ -167,24 +180,42 @@
167
180
  pgyer?: {
168
181
  /** 是否启用 */
169
182
  enable: boolean;
183
+ /** 本地安全存储中的凭据 Profile;配置后不再在 YAML 中保存秘密。 */
184
+ credentialProfile?: string;
170
185
  /** API 密钥 */
171
- apiKey: string;
186
+ apiKey?: string;
172
187
  /** 版本描述 */
173
188
  description?: string;
189
+ /** 安装权限必须显式选择,禁止依赖平台默认公开。 */
190
+ access: {
191
+ type: 'public' | 'password' | 'invite';
192
+ /** 密码安装时必填;该值属于秘密,不得写入日志或回执。 */
193
+ password?: string;
194
+ };
174
195
  };
196
+ /** 新增 Android 商店仅开放传包或草稿,送审和发布不在本批执行。 */
197
+ honor?: AndroidStoreConfig;
198
+ meizu?: AndroidStoreConfig;
199
+ samsung?: AndroidStoreConfig;
175
200
  /** 华为应用市场配置 */
176
201
  huawei?: {
177
202
  /** 是否启用 */
178
203
  enable: boolean;
179
- /** 认证信息 */
180
- auth: {
204
+ /** 本地安全存储中的凭据 Profile。 */
205
+ credentialProfile?: string;
206
+ /** API 客户端或安全库还原的 Service Account。 */
207
+ auth?: {
181
208
  /** 客户端 ID */
182
- clientId: string;
209
+ clientId?: string;
183
210
  /** 客户端密钥 */
184
- clientSecret: string;
211
+ clientSecret?: string;
212
+ /** 仅由本机安全库还原到执行内存;不得写入项目 YAML。 */
213
+ serviceAccountJsonContent?: string;
185
214
  };
186
215
  /** 应用 ID */
187
216
  appId: string;
217
+ /** Android 应用包名;用于上传前核对 APK/AAB 身份。 */
218
+ packageName?: string;
188
219
  /** 发布类型:草稿或提交审核 */
189
220
  releaseType?: 'draft' | 'submit';
190
221
  /**
@@ -209,14 +240,18 @@
209
240
  xiaomi?: {
210
241
  /** 是否启用 */
211
242
  enable: boolean;
243
+ /** 本地安全存储中的凭据 Profile。 */
244
+ credentialProfile?: string;
212
245
  /** 认证信息 */
213
- auth: {
246
+ auth?: {
214
247
  /** 开发者账号邮箱 */
215
248
  userName: string;
216
249
  /** API 访问密码 (非登录密码) */
217
250
  privateKey: string;
218
251
  /** 小米分配的 RSA 公钥文件路径 */
219
252
  publicKeyPath?: string;
253
+ /** 从 credentialProfile 解析到内存的 RSA 公钥内容;不得写回 YAML。 */
254
+ publicKeyContent?: string;
220
255
  };
221
256
  /** 应用包名 (可选, 不填则从 APK 推断) */
222
257
  packageName?: string;
@@ -248,27 +283,55 @@
248
283
  /** 手机截图路径列表 (新增应用至少 3 张) */
249
284
  screenshots?: string[];
250
285
  };
286
+ /**
287
+ * 2026-02-04 起小米自动发布接口采用的结构化测试账号。
288
+ * 账号、密码与验证码均按凭据处理,不得进入日志、回执或模型上下文。
289
+ */
290
+ testAccount?: {
291
+ accounts?: Array<{
292
+ /** 1=账号密码,2=短信验证码 */
293
+ t: 1 | 2;
294
+ /** 账号或手机号 */
295
+ a?: string;
296
+ /** 密码或验证码 */
297
+ p?: string;
298
+ /** 注册码或准入码 */
299
+ c?: string;
300
+ }>;
301
+ /** 审核补充说明,最多 500 字符 */
302
+ auditNotes?: string;
303
+ };
251
304
  };
252
305
  /** 鸿蒙应用市场配置 */
253
306
  harmony?: {
254
307
  /** 是否启用 */
255
308
  enable: boolean;
256
- /** 认证信息 */
257
- auth: {
309
+ /** 本地安全存储中的凭据 Profile。 */
310
+ credentialProfile?: string;
311
+ /** API 客户端或安全库还原的 Service Account。 */
312
+ auth?: {
258
313
  /** 客户端 ID */
259
- clientId: string;
314
+ clientId?: string;
260
315
  /** 客户端密钥 */
261
- clientSecret: string;
316
+ clientSecret?: string;
317
+ /** 仅由本机安全库还原到执行内存;不得写入项目 YAML。 */
318
+ serviceAccountJsonContent?: string;
262
319
  };
263
320
  /** 应用 ID */
264
321
  appId: string;
265
- /** 发布类型:草稿或提交审核 */
266
- releaseType?: 'draft' | 'submit';
322
+ /** HarmonyOS bundleName;用于上传前核对 HAP/APP 身份。 */
323
+ packageName?: string;
324
+ /** 当前仅开放草稿;送审能力完成验证前不进入首版。 */
325
+ releaseType?: 'draft';
267
326
  };
268
327
  /** App Store 配置 */
269
328
  app_store?: {
329
+ /** 只读凭据核验使用的明确 Bundle ID;省略时不能开始自动配置,不影响原手动上传。 */
330
+ packageName?: string;
270
331
  /** 是否启用 */
271
332
  enable: boolean;
333
+ /** 本地安全存储中的凭据 Profile。 */
334
+ credentialProfile?: string;
272
335
  /** 发布模式:app_store | testflight | adhoc */
273
336
  mode?: 'app_store' | 'testflight' | 'adhoc';
274
337
  /**
@@ -278,7 +341,7 @@
278
341
  */
279
342
  appId?: string;
280
343
  /** 认证信息(至少配置一种认证方式) */
281
- auth: {
344
+ auth?: {
282
345
  /**
283
346
  * CLI 上传凭据(Apple ID + App-specific Password)
284
347
  * 用于 Transporter / altool 上传 IPA
@@ -343,8 +406,10 @@
343
406
  oppo?: {
344
407
  /** 是否启用 */
345
408
  enable: boolean;
409
+ /** 本地安全存储中的凭据 Profile。 */
410
+ credentialProfile?: string;
346
411
  /** 认证信息 */
347
- auth: {
412
+ auth?: {
348
413
  /** 客户端 ID (OPPO 开放平台分配) */
349
414
  clientId: string;
350
415
  /** 客户端密钥 */
@@ -358,13 +423,29 @@
358
423
  * 2: 定时发布
359
424
  */
360
425
  onlineType?: '1' | '2';
426
+ /** 缺少线上可复用值时必须显式提供的送审资料,禁止使用虚假兜底。 */
427
+ submission?: {
428
+ summary?: string;
429
+ detailDescription?: string;
430
+ privacyPolicyUrl?: string;
431
+ testDescription?: string;
432
+ businessContact?: {
433
+ name?: string;
434
+ email?: string;
435
+ mobile?: string;
436
+ };
437
+ copyrightUrl?: string;
438
+ ageLevel?: string;
439
+ };
361
440
  };
362
441
  /** vivo 应用商店配置 */
363
442
  vivo?: {
364
443
  /** 是否启用 */
365
444
  enable: boolean;
445
+ /** 本地安全存储中的凭据 Profile。 */
446
+ credentialProfile?: string;
366
447
  /** 认证信息 */
367
- auth: {
448
+ auth?: {
368
449
  /** Access Key (vivo 开放平台分配) */
369
450
  accessKey: string;
370
451
  /** Access Secret */
@@ -380,8 +461,10 @@
380
461
  tencent?: {
381
462
  /** 是否启用 */
382
463
  enable: boolean;
464
+ /** 本地安全存储中的凭据 Profile。 */
465
+ credentialProfile?: string;
383
466
  /** 认证信息 */
384
- auth: {
467
+ auth?: {
385
468
  /** 开发者用户 ID (分配给开发者的数字 ID) */
386
469
  userId: string;
387
470
  /** 应用 ID (应用宝分配的应用标识) */
@@ -396,8 +479,10 @@
396
479
  google_play?: {
397
480
  /** 是否启用 */
398
481
  enable: boolean;
482
+ /** 本地安全存储中的凭据 Profile。 */
483
+ credentialProfile?: string;
399
484
  /** 认证信息 */
400
- auth: {
485
+ auth?: {
401
486
  /** 服务账号 JSON 文件路径 */
402
487
  serviceAccountJsonPath?: string;
403
488
  /** 服务账号 JSON 内容 */
@@ -405,8 +490,8 @@
405
490
  };
406
491
  /** 包名 */
407
492
  packageName?: string;
408
- /** 发布轨道;首版只支持 internal */
409
- track?: 'internal';
493
+ /** 保存草稿的轨道,默认 internal;production 也只保存草稿,不送审或上线。 */
494
+ track?: 'internal' | 'production';
410
495
  };
411
496
  /** 未来扩展的其他平台 */
412
497
  [key: string]: any;
@@ -419,13 +504,15 @@
419
504
  version: string;
420
505
  /** 应用名称 */
421
506
  appName?: string;
507
+ /** 应用包名或 Bundle ID */
508
+ packageName?: string;
422
509
  /** 构建号 */
423
510
  buildNumber: string;
424
511
  /** 更新日志 */
425
512
  changelog: string;
426
513
  /** 本次要上传到的平台列表 */
427
514
  platform?: string[];
428
- /** 构建产物路径(apk/ipa,支持 Record<ABI, Path> 形式以适配多架构) */
515
+ /** 构建产物路径(apk/aab/hap/app/ipa,支持 Record<ABI, Path> 形式以适配多架构) */
429
516
  artifactPath?: string | Record<string, string>;
430
517
  /** 按平台保留的产物集合,供上传调度层选择单包或多架构组合 */
431
518
  platformArtifacts?: Record<string, string | Record<string, string>>;
@@ -455,8 +542,8 @@
455
542
  /** 二维码地址 */
456
543
  qrCode?: string;
457
544
  /**
458
- * 原始错误对象 (可选)
459
- * 仅用于调试,UI 不应直接展示此字段
545
+ * 已脱敏错误对象 (可选)
546
+ * 禁止返回含请求头、Token、签名参数或完整平台响应的原始错误。
460
547
  */
461
548
  error?: Error | any;
462
549
  /** 平台特有的响应数据 */
@@ -476,7 +563,7 @@
476
563
  /**
477
564
  * 上传产物
478
565
  */
479
- upload(filePath: string, config: any, metadata: AppMetadata): Promise<UploadResult>;
566
+ upload(filePath: string, config: any, metadata: AppMetadata, onProgress?: ReleaseProgressObserver): Promise<UploadResult>;
480
567
  /**
481
568
  * 判断该上传器是否能处理指定文件
482
569
  * 用于多文件混合上传的智能分发
@@ -501,147 +588,860 @@
501
588
  /** 平台:android | ios | harmony */
502
589
  platform: 'android' | 'ios' | 'harmony';
503
590
  }
591
+ /** 荣耀、魅族和三星共用的公开配置;私钥内容只在本机执行内存出现。 */
592
+ interface AndroidStoreConfig {
593
+ enable: boolean;
594
+ credentialProfile?: string;
595
+ packageName: string;
596
+ appId?: string;
597
+ releaseType?: 'draft';
598
+ gms?: 'Y' | 'N';
599
+ binarySeq?: string;
600
+ auth?: {
601
+ clientId?: string;
602
+ clientSecret?: string;
603
+ serviceAccountId?: string;
604
+ privateKeyPath?: string;
605
+ privateKeyContent?: string;
606
+ };
607
+ }
504
608
 
505
- declare class EnvValidator {
506
- /**
507
- * 验证环境变量
508
- * @param requiredVars 必需的环境变量列表
509
- */
510
- static validate(requiredVars: string[]): boolean;
609
+ /** App Ship 首版正式支持的平台标识。TestFlight 与 Ad Hoc 在验证完成前不进入此集合。 */
610
+ type ReleasePlatform = 'pgyer' | 'huawei' | 'harmony' | 'xiaomi' | 'oppo' | 'vivo' | 'tencent' | 'app_store' | 'google_play' | 'honor' | 'meizu' | 'samsung';
611
+ /** 平台真实动作,禁止再用 upload 统称所有远端副作用。 */
612
+ type ReleaseAction = 'upload_build' | 'create_draft' | 'distribute_test_build' | 'submit_review' | 'submit_review_auto_release' | 'schedule_release_after_review';
613
+ /** 发布目标的业务类型;构建产物可以来自任意技术栈。 */
614
+ type ReleaseChannelKind = 'test_distribution' | 'store';
615
+ type ReleaseResultingState = 'build_uploaded' | 'draft_created' | 'test_build_distributed' | 'review_submitted' | 'review_submitted_auto_release' | 'review_submitted_scheduled_release';
616
+ type ReleaseAfterApproval = 'not_applicable' | 'manual_release' | 'auto_release' | 'scheduled_release' | 'platform_controlled';
617
+ type ReleaseRiskLevel = 'low' | 'medium' | 'high' | 'critical';
618
+ type ReleaseWithdrawal = 'not_applicable' | 'console_only' | 'api_supported' | 'not_verified' | 'unsupported';
619
+ type ReleaseCancelUntil = 'before_remote_request' | 'before_distribution_created' | 'while_remote_draft_exists' | 'before_review_starts_if_platform_allows' | 'platform_controlled' | 'not_verified';
620
+ interface ReleasePlatformCapability {
621
+ platform: ReleasePlatform;
622
+ channelKind: ReleaseChannelKind;
623
+ supportedActions: readonly ReleaseAction[];
624
+ defaultAction: ReleaseAction;
625
+ resultingState: ReleaseResultingState;
626
+ afterApproval: ReleaseAfterApproval;
627
+ cancelUntil: ReleaseCancelUntil;
628
+ withdrawal: ReleaseWithdrawal;
629
+ riskLevel: ReleaseRiskLevel;
630
+ /** 送审与直接分发动作默认禁止自动重试,避免重复版本或重复送审。 */
631
+ automaticRetry: 'allowed_for_pre_submission_steps' | 'disabled';
632
+ requiresExplicitConfirmation: boolean;
633
+ evidence: 'official_documentation' | 'code_observation' | 'official_and_code';
634
+ note: string;
635
+ }
636
+ /**
637
+ * 当前平台能力矩阵。
638
+ *
639
+ * OPPO、vivo、腾讯的动作结论来自当前适配器代码;字段级官方验证完成前维持最高风险。
640
+ */
641
+ declare const RELEASE_PLATFORM_CAPABILITIES: Readonly<Record<ReleasePlatform, ReleasePlatformCapability>>;
642
+ interface ReleaseArtifactBinding {
643
+ path: string;
644
+ sha256: string;
645
+ sizeBytes: number;
646
+ }
647
+ interface ReleasePlanInput {
648
+ platform: ReleasePlatform;
649
+ action: ReleaseAction;
650
+ packageName: string;
651
+ versionName: string;
652
+ buildNumber: string;
653
+ artifact: ReleaseArtifactBinding;
654
+ credentialProfile: string;
655
+ /** 蒲公英分发必须显式给出安装权限,禁止依赖平台默认公开。 */
656
+ distributionAccess?: 'public' | 'password' | 'invite';
657
+ scheduledReleaseAt?: string;
658
+ /** 新增商店的应用标识与公开配置指纹必须参与确认绑定。 */
659
+ targetAppId?: string;
660
+ targetConfiguration?: string;
511
661
  }
662
+ interface ReleasePlan extends ReleasePlanInput {
663
+ schemaVersion: 1;
664
+ planId: string;
665
+ channelKind: ReleaseChannelKind;
666
+ resultingState: ReleaseResultingState;
667
+ afterApproval: ReleaseAfterApproval;
668
+ cancelUntil: ReleaseCancelUntil;
669
+ withdrawal: ReleaseWithdrawal;
670
+ riskLevel: ReleaseRiskLevel;
671
+ automaticRetry: ReleasePlatformCapability['automaticRetry'];
672
+ requiresExplicitConfirmation: boolean;
673
+ }
674
+ interface ReleaseConfirmation {
675
+ planId: string;
676
+ platform: ReleasePlatform;
677
+ action: ReleaseAction;
678
+ artifactSha256: string;
679
+ confirmedAt: string;
680
+ }
681
+ /** 创建不可含秘密的发布计划,并将平台、版本与产物 SHA-256 固定到 planId。 */
682
+ declare function createReleasePlan(input: ReleasePlanInput): ReleasePlan;
683
+ /** 验证逐平台确认是否仍与当前计划和产物完全一致。 */
684
+ declare function assertReleaseConfirmation(plan: ReleasePlan, confirmation: ReleaseConfirmation | undefined): void;
685
+ /** 用于 CLI/UI/MCP 预览;固定展示安全决策字段,不包含任何凭据值。 */
686
+ declare function formatReleasePlan(plan: ReleasePlan): string;
687
+ declare function isSubmissionAction(action: ReleaseAction): boolean;
512
688
 
513
- declare class ConfigValidator {
514
- /**
515
- * 加载并验证配置文件
516
- * @param filePath 配置文件路径
517
- */
518
- static loadAndValidate(filePath: string): UploadConfig | null;
689
+ type CredentialStorageKind = 'os_secure_storage' | 'encrypted_local_vault' | 'external_file';
690
+ /** MCP 与模型允许读取的凭据元数据;禁止增加秘密值、路径或可还原摘要。 */
691
+ interface CredentialProfileMetadata {
692
+ credentialProfile: string;
693
+ platform: ReleasePlatform;
694
+ configured: boolean;
695
+ verified: boolean;
696
+ storageKind: CredentialStorageKind;
697
+ verifiedAt?: string;
698
+ }
699
+ /** UI、CLI 和 MCP 可使用的只读目录接口。 */
700
+ interface CredentialProfileCatalog {
701
+ listMetadata(): Promise<CredentialProfileMetadata[]>;
702
+ getMetadata(credentialProfile: string): Promise<CredentialProfileMetadata | undefined>;
703
+ }
704
+ /**
705
+ * 仅可信本机执行器与用户主动查看边界可使用的秘密材料。
706
+ *
707
+ * 文件型凭据可以返回已在本地安全读取的内容,也可以返回经过安全检查的外部路径;
708
+ * 该对象不得进入日志、回执、MCP 返回值或模型上下文。
709
+ */
710
+ interface CredentialMaterial {
711
+ /** 档案的标量账号字段,仅保留在可信调用内存中。 */
712
+ fields: Readonly<Record<string, string>>;
713
+ /** 文件型账号材料;没有文件时省略,普通 local_display 不返回此字段。 */
714
+ files?: Readonly<Record<string, {
715
+ /** 安全读取或解密后的正文;未载入正文时省略。 */
716
+ content?: string;
717
+ /** 已通过存储边界检查的外部路径;文件内容已内存化时省略。 */
718
+ externalPath?: string;
719
+ }>>;
720
+ }
721
+ /** 受信任本机调用的明确用途;普通回显和用户主动查看文件分别授权。 */
722
+ interface CredentialResolveRequest {
723
+ /** 本机安全库中已保存的账号引用。 */
724
+ credentialProfile: string;
725
+ /** 必须与该引用登记的平台相同。 */
726
+ platform: ReleasePlatform;
727
+ /** local_display 仅回显标量;local_view 仅用于用户主动查看文件;local_export 继续拒绝。 */
728
+ purpose: 'verify' | 'release_execution' | 'local_display' | 'local_view' | 'local_export';
729
+ }
730
+ /** 仅可信本地执行边界可注入此接口;不要把它暴露为 MCP Tool。 */
731
+ interface CredentialResolver {
732
+ resolveForLocalExecution(request: CredentialResolveRequest): Promise<CredentialMaterial>;
733
+ }
734
+ /** 操作系统安全存储的最小边界;实现不得把秘密放入命令参数、日志或错误。 */
735
+ interface SecretStore {
736
+ getSecret(account: string): Promise<string | undefined>;
737
+ setSecret(account: string, secret: string): Promise<void>;
738
+ deleteSecret(account: string): Promise<boolean>;
739
+ }
740
+ interface CredentialProfileWriteInput {
741
+ credentialProfile: string;
742
+ platform: ReleasePlatform;
743
+ material: CredentialMaterial;
744
+ }
745
+ /** CLI 管理凭据时使用的写接口,不得注册为 MCP Tool。 */
746
+ interface CredentialProfileStore extends CredentialProfileCatalog, CredentialResolver {
747
+ saveProfile(input: CredentialProfileWriteInput, options?: {
748
+ overwrite?: boolean;
749
+ }): Promise<CredentialProfileMetadata>;
750
+ deleteProfile(credentialProfile: string): Promise<boolean>;
751
+ }
752
+ /** 防止实现方意外把秘密字段混入可公开元数据。 */
753
+ declare function assertSafeCredentialMetadata(metadata: CredentialProfileMetadata): void;
754
+ /** 限制 Profile 名进入文件、Keychain account 和日志标识后的字符边界。 */
755
+ declare function assertCredentialProfileName(value: string): void;
756
+
757
+ /** 这是当次只读鉴权结果,不能据此声称已经获得上传权限或完成分发。 */
758
+ interface PgyerCredentialVerification {
759
+ platform: 'pgyer';
760
+ credentialProfile: string;
761
+ verified: boolean;
762
+ checkedAt: string;
763
+ code: 'verified' | 'credentials_unavailable' | 'invalid_credentials' | 'rejected' | 'network_unavailable' | 'invalid_response' | 'cancelled';
764
+ }
765
+ /** 固定 HTTPS 只读接口;禁止重定向、重试和原始错误输出,取消后不读取凭据。 */
766
+ declare function verifyPgyerCredentialProfile(credentialProfile: string, store: CredentialResolver, signal?: AbortSignal, transport?: typeof fetch): Promise<PgyerCredentialVerification>;
767
+
768
+ declare const PREFLIGHT_PLATFORMS: readonly ["huawei", "harmony", "pgyer", "honor", "meizu", "samsung", "xiaomi", "oppo", "vivo", "tencent", "app_store", "google_play"];
769
+ /** 全部十二家只读凭据核验渠道,不含被阻断的历史上传目标。 */
770
+ type PreflightPlatform = (typeof PREFLIGHT_PLATFORMS)[number];
771
+ declare const PREFLIGHT_CODES: readonly ["verified", "credentials_unavailable", "invalid_credentials", "rejected", "application_not_found", "ambiguous_application", "application_mismatch", "network_unavailable", "invalid_response", "cancelled", "application_not_ready", "lookup_limit_exceeded", "unsupported_credential_method"];
772
+ /** 核验允许对外公开的固定结果码,不含供应商原文。 */
773
+ type PreflightCode = (typeof PREFLIGHT_CODES)[number];
774
+ /** 核验只证明当次鉴权及应用查询;只读接口不能证明实际上传或送审权限。 */
775
+ interface PublishPreflight {
776
+ /** 本次核验的固定商店渠道。 */
777
+ platform: PreflightPlatform;
778
+ /** 只解析当前平台的本机安全档案引用。 */
779
+ credentialProfile: string;
780
+ /** 明确的 Android 包名或 Apple Bundle ID,不从文件名猜测。 */
781
+ packageName: string;
782
+ /** 鉴权和适用的目标应用查询均通过时为 true。 */
783
+ verified: boolean;
784
+ /** 本次成功或失败的固定分类。 */
785
+ code: PreflightCode;
786
+ /** 本次核验时间,ISO 8601 格式。 */
787
+ checkedAt: string;
788
+ /** 当次鉴权阶段是否已经通过。 */
789
+ authentication: 'verified' | 'not_verified';
790
+ /** 应用查询是否匹配;蒲公英不预建应用,使用 not_required。 */
791
+ application: 'matched' | 'not_verified' | 'not_required';
792
+ /** 只读请求不证明上传权限,固定为 not_verified。 */
793
+ uploadPermission: 'not_verified';
794
+ /** 接口明确返回并核对的数字应用 ID;不返回 ID 的渠道省略。 */
795
+ appId?: string;
796
+ }
797
+ /**
798
+ * 校验明确目标标识,Apple 允许连字符,其余渠道沿用既有 Android 包名约束。
799
+ * @param value - 已保存的目标包名或 Bundle ID,最长 256 字符。
800
+ * @param platform - Apple 使用 app_store;省略时沿用 Android 包名规则。
801
+ */
802
+ declare function assertPublishPackageName(value: string, platform?: string): void;
803
+ /**
804
+ * 通过各平台固定只读接口核验账号与应用;不上传,也不自动更换已有目标。
805
+ * @param input - 已保存的明确渠道、Profile 与包名;可选 App ID 必须与查询结果一致。
806
+ * @param store - 本机可信凭据解析器,不回退到另一账号。
807
+ * @param signal - 可选取消信号;取消后不返回核验成功。
808
+ * @param transport - 可选 HTTP 边界,默认使用本机 fetch;全程限时 20 秒。
809
+ */
810
+ declare function preflightPublish(input: {
811
+ /** 本次核验的固定商店渠道。 */
812
+ platform: PreflightPlatform;
813
+ /** 只解析当前平台的本机安全档案引用。 */
814
+ credentialProfile: string;
815
+ /** 明确的 Android 包名或 Apple Bundle ID,不从文件名猜测。 */
816
+ packageName: string;
817
+ /** 已保存的数字应用 ID;省略时由对应只读查询确定,不覆盖冲突目标。 */
818
+ appId?: string;
819
+ }, store: CredentialResolver, signal?: AbortSignal, transport?: typeof fetch): Promise<PublishPreflight>;
820
+
821
+ interface HuaweiServiceAccount {
822
+ key_id: string;
823
+ sub_account: string;
824
+ private_key: string;
825
+ }
826
+ /** 只接受完整的已有服务账号私钥;创建、扩权和密钥轮换由人处理。 */
827
+ declare function parseHuaweiServiceAccount(content: string): HuaweiServiceAccount;
828
+ /** JWT 只保留在执行内存,按官方规范使用固定 aud、3600 秒有效期及 32 字节 PSS 盐。 */
829
+ declare function createHuaweiServiceAccountToken(content: string, now?: number): string;
830
+
831
+ declare const CREDENTIAL_CONSOLES: {
832
+ readonly huawei: "https://developer.huawei.com/consumer/cn/hdc-console/index.html#/home/101653523124950083";
833
+ readonly harmony: "https://developer.huawei.com/consumer/cn/hdc-console/index.html#/home/101653523124950083";
834
+ readonly pgyer: "https://www.pgyer.com/account/api";
835
+ readonly honor: "https://developer.honor.com/cn/manageCenter";
836
+ readonly meizu: "https://developer.meizu.com/";
837
+ readonly samsung: "https://seller.samsungapps.com/";
838
+ readonly xiaomi: "https://dev.mi.com/distribute";
839
+ readonly oppo: "https://open.oppomobile.com/new/ecology/myApi";
840
+ readonly vivo: "https://dev.vivo.com.cn/personalCenter";
841
+ readonly tencent: "https://app.open.qq.com/p/app/list";
842
+ readonly app_store: "https://appstoreconnect.apple.com/access/integrations/api";
843
+ readonly google_play: "https://console.cloud.google.com/iam-admin/serviceaccounts";
844
+ };
845
+ /** 公开状态仅含调用关联、凭据引用及期限;不包含磁盘路径、秘密和浏览器原文。 */
846
+ interface CredentialSetupStatus {
847
+ /** 十分钟采集任务的本机 UUID,不含材料。 */
848
+ setupId: string;
849
+ /** 当前任务固定的渠道,捕获后也不能改变。 */
850
+ platform: PreflightPlatform;
851
+ /** 当前任务保存或复用的安全档案名称。 */
852
+ credentialProfile: string;
853
+ /** 任务明确绑定的包名或 Bundle ID。 */
854
+ packageName: string;
855
+ /** 当前任务阶段;configured/cancelled 为终态,未完成任务到期后显示 expired。 */
856
+ status: 'waiting_for_browser' | 'captured' | 'configured' | 'expired' | 'cancelled';
857
+ /** 到期 Unix 时间,单位毫秒;完成后只作历史元数据。 */
858
+ expiresAt: number;
859
+ /** 打开供应商官方控制台的固定入口,不含认证字段。 */
860
+ consoleUrl: string;
861
+ }
862
+ /**
863
+ * 精确匹配官方 HTTPS 凭据页;华为及蒲公英新版只开放已核对的路由,不接受登录回调或任意控制台页。
864
+ * @param value - 浏览器当前标签页的完整地址;非法地址或不支持的页面返回 undefined。
865
+ */
866
+ declare function credentialPagePlatform(value: string): PreflightPlatform | undefined;
867
+ /** 仅操作当前用户私有请求目录;Native Host 与 MCP 复用同一个 Profile Store。 */
868
+ declare class CredentialSetupService {
869
+ private readonly store;
870
+ private readonly directory;
871
+ private readonly transport;
872
+ private readonly now;
873
+ constructor(store: CredentialProfileStore, directory?: string, transport?: typeof fetch, now?: () => number);
874
+ private privateDirectory;
875
+ private readFile;
876
+ private filename;
877
+ /**
878
+ * 从私有目录读取并校验本机任务,不读取凭据。
879
+ * @param id - 当前任务的 UUID;不接受任意路径。
880
+ */
881
+ private load;
882
+ private status;
883
+ private save;
884
+ private locked;
885
+ /**
886
+ * 创建十分钟任务或复用已有 Profile;不读取浏览器、秘密或修改配置。
887
+ * @param input - 已保存的目标渠道与配置身份,不要求启用上传;更换账号须显式 refreshExisting。
888
+ */
889
+ begin(input: {
890
+ /** 当前项目已保存配置的绝对路径或相对当前进程的路径。 */
891
+ configPath: string;
892
+ /** 当前支持的十二渠道之一。 */
893
+ platform: PreflightPlatform;
894
+ /** 必须与配置完全相同的目标包名或 Bundle ID。 */
895
+ packageName: string;
896
+ /** 可选已有档案;省略时优先复用配置引用,再创建唯一名称。 */
897
+ credentialProfile?: string;
898
+ /** true 时创建新档案,核验成功前保留旧引用;默认 false。 */
899
+ refreshExisting?: boolean;
900
+ }): Promise<CredentialSetupStatus>;
901
+ /** 状态读取没有隐式保存、网络请求或补配副作用。 */
902
+ inspect(id: string): Promise<CredentialSetupStatus>;
903
+ /** 扩展只处理当前站点的唯一待采集请求,多请求时要求调用方明确选择。 */
904
+ pending(pageUrl: string): Promise<CredentialSetupStatus[]>;
905
+ /** 仅列出需要已有文件的六渠道待处理任务,不读取网页或密钥文件。 */
906
+ pendingImports(): Promise<CredentialSetupStatus[]>;
907
+ private waiting;
908
+ /** 仅供受信任 Native Host;材料不进入 MCP,且不能覆盖已有 Profile 或创建商店密钥。 */
909
+ capture(id: string, pageUrl: string, input: unknown): Promise<CredentialSetupStatus>;
910
+ /** 用户在扩展自身的文件选择器选择已有 JSON;材料不会进入商店页面或模型参数。 */
911
+ importServiceAccount(id: string, content: string): Promise<CredentialSetupStatus>;
912
+ /** 三星账号 ID 与已有私钥必须在同一任务中一起导入;不在网页上生成新密钥。 */
913
+ importSamsungPrivateKey(id: string, serviceAccountId: string, content: string): Promise<CredentialSetupStatus>;
914
+ /**
915
+ * 导入 Apple/Google/小米已有文件并配对账号字段;仅受信任 Native Host 调用。
916
+ * @param id - 当前等待采集的本机任务,平台不能由文件覆盖。
917
+ * @param content - 用户已下载文件的内存内容,不是路径或网络地址。
918
+ * @param fields - 当前平台所需的配对字段;Google 必须为空对象。
919
+ */
920
+ importCredentialFile(id: string, content: string, fields: Record<string, string>): Promise<CredentialSetupStatus>;
921
+ /**
922
+ * 校验平台专属字段并写入不可覆盖的安全档案,文件型渠道须使用导入入口。
923
+ * @param task - 已锁定且仍在等待采集的当前任务。
924
+ * @param input - 浏览器经本机管道提交的材料,不允许额外或被遮盖字段。
925
+ */
926
+ private saveCaptured;
927
+ /**
928
+ * 核验成功后补入 Profile/App ID 并同步已有表单快照;配置变化、冲突或取消停止写入。
929
+ * @param id - 本机采集任务标识,必须处于已采集状态或已经完成。
930
+ * @param signal - 可选取消信号,核验及配置落盘前再次检查。
931
+ * @param assertCurrent - 可选宿主检查,在原子替换前确认当前项目未改变。
932
+ */
933
+ complete(id: string, signal?: AbortSignal, assertCurrent?: () => void): Promise<{
934
+ code: string;
935
+ /** 十分钟采集任务的本机 UUID,不含材料。 */
936
+ setupId: string;
937
+ /** 当前任务固定的渠道,捕获后也不能改变。 */
938
+ platform: PreflightPlatform;
939
+ /** 当前任务保存或复用的安全档案名称。 */
940
+ credentialProfile: string;
941
+ /** 任务明确绑定的包名或 Bundle ID。 */
942
+ packageName: string;
943
+ /** 当前任务阶段;configured/cancelled 为终态,未完成任务到期后显示 expired。 */
944
+ status: "waiting_for_browser" | "captured" | "configured" | "expired" | "cancelled";
945
+ /** 到期 Unix 时间,单位毫秒;完成后只作历史元数据。 */
946
+ expiresAt: number;
947
+ /** 打开供应商官方控制台的固定入口,不含认证字段。 */
948
+ consoleUrl: string;
949
+ } | {
950
+ preflight: PublishPreflight;
951
+ /** 十分钟采集任务的本机 UUID,不含材料。 */
952
+ setupId: string;
953
+ /** 当前任务固定的渠道,捕获后也不能改变。 */
954
+ platform: PreflightPlatform;
955
+ /** 当前任务保存或复用的安全档案名称。 */
956
+ credentialProfile: string;
957
+ /** 任务明确绑定的包名或 Bundle ID。 */
958
+ packageName: string;
959
+ /** 当前任务阶段;configured/cancelled 为终态,未完成任务到期后显示 expired。 */
960
+ status: "waiting_for_browser" | "captured" | "configured" | "expired" | "cancelled";
961
+ /** 到期 Unix 时间,单位毫秒;完成后只作历史元数据。 */
962
+ expiresAt: number;
963
+ /** 打开供应商官方控制台的固定入口,不含认证字段。 */
964
+ consoleUrl: string;
965
+ }>;
966
+ /** 取消只关闭请求,已保存的 Profile 保留;绝不隐式删除用户凭据。 */
967
+ cancel(id: string): Promise<CredentialSetupStatus>;
968
+ }
969
+
970
+ declare const DEFAULT_CREDENTIAL_VAULT_PATH: string;
971
+ interface SecurityCommandResult {
972
+ code: number;
973
+ stdout: string;
974
+ }
975
+ type SecurityCommandRunner = (args: string[], input?: string) => Promise<SecurityCommandResult>;
976
+ /**
977
+ * macOS Keychain 适配器。
978
+ *
979
+ * 写入时让 `security` 从 stdin 读取秘密,避免秘密出现在进程参数或错误文本中。
980
+ */
981
+ declare class MacOSKeychainSecretStore implements SecretStore {
982
+ private readonly service;
983
+ private readonly runner;
984
+ constructor(service?: string, runner?: SecurityCommandRunner);
985
+ getSecret(account: string): Promise<string | undefined>;
986
+ setSecret(account: string, secret: string): Promise<void>;
987
+ deleteSecret(account: string): Promise<boolean>;
988
+ }
989
+ /**
990
+ * 本地凭据 Profile 存储。
991
+ *
992
+ * 标量秘密保存在操作系统安全存储;文件型凭据使用 Keychain 主密钥进行
993
+ * AES-256-GCM 加密。Vault 明文区只保存允许 MCP 读取的元数据。
994
+ */
995
+ declare class LocalCredentialProfileStore implements CredentialProfileStore {
996
+ private readonly secretStore;
997
+ private readonly vaultPath;
998
+ constructor(secretStore: SecretStore, vaultPath?: string);
999
+ listMetadata(): Promise<CredentialProfileMetadata[]>;
1000
+ getMetadata(credentialProfile: string): Promise<CredentialProfileMetadata | undefined>;
1001
+ saveProfile(input: CredentialProfileWriteInput, options?: {
1002
+ overwrite?: boolean;
1003
+ }): Promise<CredentialProfileMetadata>;
1004
+ private saveProfileUnlocked;
1005
+ deleteProfile(credentialProfile: string): Promise<boolean>;
1006
+ private deleteProfileUnlocked;
1007
+ /**
1008
+ * 为可信本机调用读取当前平台材料;普通回显不解密文件,主动查看仅在本机返回内容。
1009
+ * @param request - 明确平台、档案与用途;local_view 由用户点击查看触发,local_export 继续拒绝。
1010
+ */
1011
+ resolveForLocalExecution(request: CredentialResolveRequest): Promise<CredentialMaterial>;
1012
+ private encryptFiles;
1013
+ private decryptFiles;
1014
+ private getOrCreateMasterKey;
1015
+ private getMasterKey;
1016
+ private restoreSecret;
1017
+ private readDocument;
1018
+ /** 多个 Native Host/CLI 进程共享同一安全库,读改写必须排他;冲突明确失败,不覆盖或自动重试。 */
1019
+ private withWriteLock;
1020
+ private writeDocument;
1021
+ }
1022
+ /** 创建当前平台已验证的默认凭据存储;其它平台必须显式失败。 */
1023
+ declare function createDefaultCredentialProfileStore(vaultPath?: string): LocalCredentialProfileStore;
1024
+
1025
+ interface CredentialMigrationOptions {
1026
+ profilePrefix?: string;
1027
+ baseDirectory?: string;
1028
+ }
1029
+ interface CredentialMigrationResult {
1030
+ config: UploadConfig;
1031
+ migratedProfiles: string[];
1032
+ }
1033
+ /**
1034
+ * 把旧 YAML 中的秘密迁移到本地 Profile,并返回不含秘密的新配置。
1035
+ * 调用方负责将返回配置写入不同文件;本函数不会覆盖原配置。
1036
+ */
1037
+ declare function migrateLegacyCredentials(source: UploadConfig, store: CredentialProfileStore, options?: CredentialMigrationOptions): Promise<CredentialMigrationResult>;
1038
+ /** 迁移必须可回滚;回滚不完整时提升为需要人工处理的安全错误。 */
1039
+ declare function rollbackCredentialProfiles(store: CredentialProfileStore, credentialProfiles: readonly string[]): Promise<void>;
1040
+ /** 仅在可信本地执行边界把 Profile 还原到内存配置,返回值不得记录或序列化。 */
1041
+ declare function hydrateCredentialProfiles(source: UploadConfig, store: CredentialResolver): Promise<UploadConfig>;
1042
+ /** 将当前可信宿主的临时账号转换为既有执行器材料;不持久化或读取文件内容。
1043
+ * @param platform - 当前单一目标渠道。
1044
+ * @param config - 该渠道的内存配置;秘密只进入本机执行器,不进入计划或日志。
1045
+ * @param baseDirectory - 相对私密文件路径的绝对解析起点。
1046
+ * @returns 有材料时返回字段/文件引用,未配置账号时返回 undefined。
1047
+ */
1048
+ declare function resolveInlineCredentialMaterial(platform: ReleasePlatform, config: any, baseDirectory: string): CredentialMaterial | undefined;
1049
+
1050
+ /**
1051
+ * 上传管理器配置
1052
+ */
1053
+ interface UploadManagerConfig {
1054
+ maxConcurrent?: number;
1055
+ continueOnError?: boolean;
1056
+ verbose?: boolean;
1057
+ cancellationToken?: {
1058
+ isCancelled: boolean;
1059
+ };
1060
+ }
1061
+ /**
1062
+ * 聚合的上传结果报告
1063
+ */
1064
+ interface UploadReport {
1065
+ totalUploads: number;
1066
+ successCount: number;
1067
+ failureCount: number;
1068
+ successPlatforms: string[];
1069
+ failurePlatforms: string[];
1070
+ results: UploadResult[];
1071
+ totalDurationMs: number;
1072
+ summary: string;
1073
+ }
1074
+ /**
1075
+ * 上传管理器 - 处理多平台并行上传
1076
+ */
1077
+ declare class UploadManager {
1078
+ private uploaders;
1079
+ private config;
1080
+ constructor(config?: UploadManagerConfig);
519
1081
  /**
520
- * 只收集本次实际启用配置中的环境变量,避免禁用平台阻塞其它上传任务。
1082
+ * 注册上传器
521
1083
  */
522
- private static collectRequiredEnvVars;
523
- /** 在内存中递归解析环境变量,不重新拼接 YAML,避免密钥字符破坏 YAML 结构。 */
524
- private static resolveEnvVars;
1084
+ registerUploader(platform: string, uploader: IUploader): void;
525
1085
  /**
526
- * 验证配置 Schema
527
- * @param config 配置对象
1086
+ * 获取启用的平台列表(根据配置)
528
1087
  */
529
- private static validateSchema;
530
- }
531
-
532
- declare class PgyerUploader implements IUploader {
533
- name: string;
534
- private static UPLOAD_API;
1088
+ getEnabledPlatforms(config: any): string[];
535
1089
  /**
536
- * 验证配置
537
- * @param config 配置对象
1090
+ * 获取可用的平台列表
538
1091
  */
539
- validateConfig(config: any): boolean;
1092
+ getAvailablePlatforms(): string[];
540
1093
  /**
541
- * 判断是否支持该文件
542
- * @param filePath 文件路径
1094
+ * 执行并行上传(支持多文件智能分发)
543
1095
  */
544
- canHandle(filePath: string): boolean;
1096
+ uploadToMultiplePlatforms(filePaths: string | string[], // 支持单文件或文件数组
1097
+ config: any, metadata: AppMetadata, targetPlatforms?: string[], signal?: AbortSignal, onProgress?: ReleaseProgressObserver): Promise<UploadReport>;
545
1098
  /**
546
- * 上传文件到蒲公英
547
- * @param filePath 文件路径
548
- * @param config 配置
549
- * @param metadata 元数据
1099
+ * 上传到单个平台
550
1100
  */
551
- upload(filePath: string, config: any, metadata: AppMetadata): Promise<UploadResult>;
1101
+ private uploadToPlatform;
552
1102
  /**
553
- * 执行实际上传操作
554
- * @param filePath 文件路径
555
- * @param apiKey API Key
556
- * @param desc 描述
1103
+ * 适配器结果是外部边界,默认只保留白名单远端标识。
1104
+ * 完整响应与请求对象可能含 Token、签名或账号信息,不能进入上层 UI/MCP。
557
1105
  */
558
- private performUpload;
559
- }
560
-
561
- declare class HuaweiUploader implements IUploader {
562
- name: string;
563
- private static DEFAULT_API_BASE;
564
- private static TOKEN_PATH;
565
- private static PUBLISH_API_PATH;
566
- /** 获取 API 基础地址 */
567
- private getApiBase;
568
- /** 获取 Token URL */
569
- private getTokenUrl;
570
- /** 获取 Publish API 根路径 */
571
- private getApiRoot;
572
- /** 创建 API 请求头(消除 7 处重复) */
573
- private headers;
574
- /** 检查 API 响应(消除 6 处重复) */
575
- private checkResponse;
1106
+ private sanitizeUploadResult;
1107
+ private shouldGroupArtifacts;
1108
+ private resolveArtifactSelection;
1109
+ private buildArtifactMapFromFiles;
1110
+ private inferArtifactKey;
1111
+ private getRepresentativeFilePath;
1112
+ private validateArtifactSelection;
576
1113
  /**
577
- * 验证配置
578
- * @param config 配置对象
579
- * @returns 是否有效
1114
+ * 聚合上传结果
580
1115
  */
581
- validateConfig(config: any): boolean;
1116
+ private aggregateResults;
582
1117
  /**
583
- * 判断是否支持该文件
584
- * @param filePath 文件路径
585
- * @returns 是否支持
1118
+ * 输出上传报告
586
1119
  */
587
- canHandle(filePath: string): boolean;
1120
+ private printReport;
588
1121
  /**
589
- * 执行上传
590
- * @param filePath 文件路径
591
- * @param config 配置
592
- * @param metadata 元数据
1122
+ * 格式化持续时间
593
1123
  */
594
- upload(filePath: string, config: any, metadata: AppMetadata): Promise<UploadResult>;
1124
+ private formatDuration;
595
1125
  /**
596
- * 查询审核状态
597
- * @param clientId 客户端 ID
598
- * @param clientSecret 客户端密钥
599
- * @param appId 应用 ID
600
- * @param apiBaseUrl API 基础地址(可选)
1126
+ * 获取可重试的失败平台
601
1127
  */
602
- queryReviewStatus(clientId: string, clientSecret: string, appId: string, apiBaseUrl?: string): Promise<any>;
1128
+ getRetryablePlatforms(report: UploadReport): string[];
603
1129
  /**
604
- * 获取 Access Token
605
- * @param tokenUrl Token URL
606
- * @param clientId 客户端 ID
607
- * @param clientSecret 客户端密钥
1130
+ * 重试失败的平台
608
1131
  */
609
- private getAccessToken;
610
- /** 获取上传 URL */
611
- private getUploadUrl;
612
- /** 通用文件上传(FormData 方式,无需 API 认证头) */
613
- private executeUploadRequest;
614
- /** 上传文件 (APK/AAB) */
615
- private uploadFile;
616
- /** 更新应用文件信息 */
617
- private updateAppFileInfo;
618
- /** 更新发布说明(支持多语言) */
619
- private updateReleaseNotes;
620
- /** 提交审核 */
621
- private submitForReview;
622
- /** 获取应用信息 */
623
- private getAppInfo;
624
- /** 上传商店素材(图标、截图、视频) */
625
- private uploadStoreAssets;
626
- /** 批量上传素材文件 */
627
- private uploadAssetFiles;
628
- /** 更新素材文件信息(关联到应用) */
629
- private updateAssetFileInfo;
1132
+ retryFailedPlatforms(failedPlatforms: string[], filePath: string | string[], config: any, metadata: AppMetadata): Promise<UploadReport>;
630
1133
  }
631
-
632
1134
  /**
633
- * 小米应用商店上传器
634
- *
635
- * 基于小米官方「应用自动发布接口」实现
636
- * 文档: https://dev.mi.com/xiaomihyperos/documentation/detail?pId=1134
637
- *
638
- * 上传流程:
639
- * 1. 构建 RequestData JSON (userName, appInfo, synchroType)
640
- * 2. 计算所有参数的 MD5 (RequestData 字符串 + APK 文件)
641
- * 3. 拼接 SIG JSON, 用 RSA 公钥加密
642
- * 4. POST multipart/form-data 到 /dev/push
1135
+ * 创建上传管理器实例
643
1136
  */
644
- declare class XiaomiUploader implements IUploader {
1137
+ declare function createUploadManager(config?: UploadManagerConfig): UploadManager;
1138
+
1139
+ declare const RELEASE_RECEIPT_SCHEMA_VERSION: 1;
1140
+ declare const DEFAULT_RELEASE_RECEIPT_LIMIT = 100;
1141
+ type ReleaseReceiptKind = 'build' | 'upload';
1142
+ type ReleaseReceiptOutcome = 'success' | 'partial' | 'failed' | 'cancelled';
1143
+ type ReleaseReceiptState = 'built' | 'uploaded' | 'draft_created' | 'review_submitted' | 'reviewing' | 'approved' | 'rejected' | 'released' | 'failed' | 'cancelled';
1144
+ interface ReleaseArtifactReceipt {
1145
+ path: string;
1146
+ name: string;
1147
+ sizeBytes?: number;
1148
+ sha256?: string;
1149
+ available: boolean;
1150
+ }
1151
+ interface ReleaseRemoteReceipt {
1152
+ consoleUrl?: string;
1153
+ downloadUrl?: string;
1154
+ identifiers?: Record<string, string | number | boolean>;
1155
+ }
1156
+ interface ReleaseTargetReceipt {
1157
+ platform: string;
1158
+ /** 绑定本次执行计划,便于把回执追溯到人工核对的动作和产物。 */
1159
+ planId?: string;
1160
+ channelKind?: ReleasePlan['channelKind'];
1161
+ action?: ReleasePlan['action'];
1162
+ resultingState?: ReleasePlan['resultingState'];
1163
+ state: ReleaseReceiptState;
1164
+ outcome: ReleaseReceiptOutcome;
1165
+ message: string;
1166
+ remote?: ReleaseRemoteReceipt;
1167
+ lastKnownRemoteStatus?: string;
1168
+ checkedAt?: string;
1169
+ }
1170
+ interface ReleaseReceipt {
1171
+ schemaVersion: typeof RELEASE_RECEIPT_SCHEMA_VERSION;
1172
+ id: string;
1173
+ projectKey: string;
1174
+ projectRoot: string;
1175
+ kind: ReleaseReceiptKind;
1176
+ appName?: string;
1177
+ packageName?: string;
1178
+ versionName?: string;
1179
+ buildNumber?: string;
1180
+ changelog?: string;
1181
+ artifacts: ReleaseArtifactReceipt[];
1182
+ targets: ReleaseTargetReceipt[];
1183
+ outcome: ReleaseReceiptOutcome;
1184
+ startedAt: string;
1185
+ finishedAt: string;
1186
+ durationMs: number;
1187
+ }
1188
+ interface ReleaseReceiptInput {
1189
+ projectRoot: string;
1190
+ kind: ReleaseReceiptKind;
1191
+ appName?: string;
1192
+ packageName?: string;
1193
+ versionName?: string;
1194
+ buildNumber?: string | number;
1195
+ changelog?: string;
1196
+ artifactPaths?: unknown;
1197
+ targets: ReleaseTargetReceipt[];
1198
+ startedAt?: string | number | Date;
1199
+ finishedAt?: string | number | Date;
1200
+ outcome?: ReleaseReceiptOutcome;
1201
+ }
1202
+ interface ReleaseReceiptStoreOptions {
1203
+ storageRoot?: string;
1204
+ maxEntries?: number;
1205
+ }
1206
+ /** 解析发布回执所属项目;显式项目目录优先,未提供时才使用配置文件目录。 */
1207
+ declare function resolveReleaseProjectRoot(projectRoot: string | undefined, configPath: string): string;
1208
+ /** 将可能包含凭据的错误信息压缩为可安全持久化的短文本。 */
1209
+ declare function sanitizeReleaseMessage(value: unknown, maxLength?: number): string;
1210
+ /** 将上传结果转换为稳定、可公开展示的渠道状态。 */
1211
+ declare function createUploadTargets(results: UploadResult[]): ReleaseTargetReceipt[];
1212
+ /** 创建回执;只接受已经挑选过的业务字段,不接受完整配置或原始响应。 */
1213
+ declare function createReleaseReceipt(input: ReleaseReceiptInput): Promise<ReleaseReceipt>;
1214
+ /** 将回执转换为适合复制给客户或 AI 的纯文本摘要。 */
1215
+ declare function formatReleaseReceipt(receipt: ReleaseReceipt): string;
1216
+ /** 按项目保存脱敏回执;同一进程中的多个实例共享写入顺序,不提供跨进程互斥。 */
1217
+ declare class ReleaseReceiptStore {
1218
+ /** 以规范化文件路径串行化读改写,完成后释放,防止并行商店覆盖彼此回执。 */
1219
+ private static readonly pendingAppends;
1220
+ /** 回执目录的绝对路径,默认位于用户目录下的 .flu-cli/release-receipts。 */
1221
+ private readonly storageRoot;
1222
+ /** 每个项目最多保留的回执条数,构造时至少为 1。 */
1223
+ private readonly maxEntries;
1224
+ /**
1225
+ * 配置本地回执目录和保留数量,不在构造时读写文件。
1226
+ * @param options - 可选存储设置;省略目录使用用户默认目录,省略数量保留 100 条。
1227
+ */
1228
+ constructor(options?: ReleaseReceiptStoreOptions);
1229
+ /**
1230
+ * 在同进程的项目文件写入队列中合并回执,再原子替换文件;失败不阻塞后续写入。
1231
+ * @param receipt - 已脱敏并带有项目键的完整回执;相同 ID 替换旧记录。
1232
+ */
1233
+ append(receipt: ReleaseReceipt): Promise<void>;
1234
+ /**
1235
+ * 读取指定项目最近的回执,项目尚无文件时返回空列表。
1236
+ * @param projectRoot - 项目目录,优先解析符号链接以统一项目身份。
1237
+ * @param limit - 返回条数上限,默认 20,负数按 0 处理。
1238
+ */
1239
+ list(projectRoot: string, limit?: number): Promise<ReleaseReceipt[]>;
1240
+ /**
1241
+ * 生成脱敏回执并等待持久化完成;保存失败向调用方抛错。
1242
+ * @param input - 应用、产物与渠道结果等允许记录的业务字段。
1243
+ */
1244
+ save(input: ReleaseReceiptInput): Promise<ReleaseReceipt>;
1245
+ /**
1246
+ * 返回项目回执文件路径,不在此创建文件。
1247
+ * @param projectKey - 已按项目规范化路径生成的稳定哈希键。
1248
+ */
1249
+ private getFilePath;
1250
+ /**
1251
+ * 读取兼容的回执集合,仅文件不存在时按空集合处理。
1252
+ * @param filePath - 当前项目的回执文件绝对路径。
1253
+ * @param projectKey - 文件所属项目键,空文件集合也使用此键。
1254
+ */
1255
+ private readFile;
1256
+ }
1257
+ declare function createProjectKey(projectRoot: string): string;
1258
+
1259
+ interface ReleaseExecutorDependencies {
1260
+ /** 只允许执行器使用本机解析能力,不需要暴露 Profile 写入接口。 */
1261
+ credentialStore: CredentialResolver;
1262
+ uploadManager?: UploadManager;
1263
+ receiptStore?: ReleaseReceiptStore;
1264
+ }
1265
+ interface ReleaseExecutionInput {
1266
+ plan: ReleasePlan;
1267
+ confirmation?: ReleaseConfirmation;
1268
+ config: UploadConfig;
1269
+ metadata?: Partial<AppMetadata>;
1270
+ projectRoot: string;
1271
+ dependencies: ReleaseExecutorDependencies;
1272
+ /** 宿主取消在远端请求开始前生效;上传已开始时不承诺撤回远端副作用。 */
1273
+ signal?: AbortSignal;
1274
+ /** 可选只读进度,载荷不包含秘密、令牌或供应商原始正文。 */
1275
+ onProgress?: ReleaseProgressObserver;
1276
+ /** 受信任本机宿主在远端请求前复核磁盘配置或会话;不能用于代替人工确认。 */
1277
+ beforeRemoteRequest?: () => Promise<void>;
1278
+ }
1279
+ interface ReleaseExecutionResult {
1280
+ plan: ReleasePlan;
1281
+ report: UploadReport;
1282
+ receipt: ReleaseReceipt;
1283
+ }
1284
+ interface ReleaseBatchExecutionResult {
1285
+ plans: readonly ReleasePlan[];
1286
+ report: UploadReport;
1287
+ receipt: ReleaseReceipt;
1288
+ }
1289
+ /**
1290
+ * 可信本机发布执行边界。
1291
+ *
1292
+ * 调用方必须先提供与当前计划绑定的人工确认;执行器随后重新读取产物和
1293
+ * credentialProfile,任何一步不一致都会在适配器发起网络请求前停止。
1294
+ */
1295
+ declare function executeReleasePlan(input: ReleaseExecutionInput): Promise<ReleaseExecutionResult>;
1296
+ declare function executeReleasePlans(input: Omit<ReleaseExecutionInput, 'plan' | 'confirmation'> & {
1297
+ plans: readonly ReleasePlan[];
1298
+ confirmations?: readonly ReleaseConfirmation[];
1299
+ }): Promise<ReleaseBatchExecutionResult>;
1300
+ /** 重新核对计划绑定的普通文件、大小、摘要和安装包身份。 */
1301
+ declare function assertReleaseArtifactMatchesPlan(plan: ReleasePlan, metadata?: Partial<AppMetadata>): Promise<void>;
1302
+
1303
+ declare class EnvValidator {
1304
+ /**
1305
+ * 验证环境变量
1306
+ * @param requiredVars 必需的环境变量列表
1307
+ */
1308
+ static validate(requiredVars: string[]): boolean;
1309
+ }
1310
+
1311
+ declare class ConfigValidator {
1312
+ /**
1313
+ * 加载并验证配置文件
1314
+ * @param filePath 配置文件路径
1315
+ */
1316
+ static loadAndValidate(filePath: string): UploadConfig | null;
1317
+ /** Profile 已在可信执行边界解析后,要求所有启用平台都具备真实认证材料。 */
1318
+ static validateResolved(config: UploadConfig): boolean;
1319
+ /**
1320
+ * 只收集本次实际启用配置中的环境变量,避免禁用平台阻塞其它上传任务。
1321
+ */
1322
+ private static collectRequiredEnvVars;
1323
+ /** 在内存中递归解析环境变量,不重新拼接 YAML,避免密钥字符破坏 YAML 结构。 */
1324
+ private static resolveEnvVars;
1325
+ /**
1326
+ * 验证配置 Schema
1327
+ * @param config 当前渠道配置及可选本地化发行说明。
1328
+ * @param allowCredentialProfiles 是否允许仅保存本机凭据引用;执行前必须为 false。
1329
+ */
1330
+ private static validateSchema;
1331
+ }
1332
+
1333
+ declare class PgyerUploader implements IUploader {
1334
+ name: string;
1335
+ private static UPLOAD_API;
1336
+ /**
1337
+ * 验证配置
1338
+ * @param config 配置对象
1339
+ */
1340
+ validateConfig(config: any): boolean;
1341
+ /**
1342
+ * 判断是否支持该文件
1343
+ * @param filePath 文件路径
1344
+ */
1345
+ canHandle(filePath: string): boolean;
1346
+ /**
1347
+ * 上传文件到蒲公英
1348
+ * @param filePath 待分发的 APK 或 IPA 本地路径。
1349
+ * @param config 已确认的蒲公英 API Key 和安装权限配置。
1350
+ * @param metadata 本次版本信息与更新日志。
1351
+ * @param onProgress 可选进度观察器,只报告本次上传与处理阶段。
1352
+ */
1353
+ upload(filePath: string, config: any, metadata: AppMetadata, onProgress?: ReleaseProgressObserver): Promise<UploadResult>;
1354
+ /**
1355
+ * 执行实际上传操作
1356
+ * @param filePath 文件路径
1357
+ * @param apiKey API Key
1358
+ * @param desc 描述
1359
+ */
1360
+ private performUpload;
1361
+ }
1362
+
1363
+ declare class HuaweiUploader implements IUploader {
1364
+ name: string;
1365
+ private static DEFAULT_API_BASE;
1366
+ private static TOKEN_PATH;
1367
+ private static PUBLISH_API_PATH;
1368
+ /** 获取 API 基础地址 */
1369
+ private getApiBase;
1370
+ /** 获取 Token URL */
1371
+ private getTokenUrl;
1372
+ /** 获取 Publish API 根路径 */
1373
+ private getApiRoot;
1374
+ /** 创建 API 请求头(消除 7 处重复) */
1375
+ private headers;
1376
+ /** 检查 API 响应(消除 6 处重复) */
1377
+ private checkResponse;
1378
+ /**
1379
+ * 验证配置
1380
+ * @param config 配置对象
1381
+ * @returns 是否有效
1382
+ */
1383
+ validateConfig(config: any): boolean;
1384
+ /**
1385
+ * 判断是否支持该文件
1386
+ * @param filePath 文件路径
1387
+ * @returns 是否支持
1388
+ */
1389
+ canHandle(filePath: string): boolean;
1390
+ /**
1391
+ * 执行上传
1392
+ * @param filePath 已确认的正式安装包路径。
1393
+ * @param config 当前渠道配置、内存认证材料及可选本地化说明。
1394
+ * @param metadata 当前计划绑定的应用版本和旧入口单语言说明。
1395
+ */
1396
+ upload(filePath: string, config: any, metadata: AppMetadata): Promise<UploadResult>;
1397
+ /**
1398
+ * 查询审核状态
1399
+ * @param clientId 客户端 ID
1400
+ * @param clientSecret 客户端密钥
1401
+ * @param appId 应用 ID
1402
+ * @param apiBaseUrl API 基础地址(可选)
1403
+ */
1404
+ queryReviewStatus(clientId: string, clientSecret: string, appId: string, apiBaseUrl?: string): Promise<any>;
1405
+ /**
1406
+ * 获取 Access Token
1407
+ * @param tokenUrl Token URL
1408
+ * @param clientId 客户端 ID
1409
+ * @param clientSecret 客户端密钥
1410
+ */
1411
+ private getAccessToken;
1412
+ /** 获取上传 URL */
1413
+ private getUploadUrl;
1414
+ /** 通用文件上传(FormData 方式,无需 API 认证头) */
1415
+ private executeUploadRequest;
1416
+ /** 上传文件 (APK/AAB) */
1417
+ private uploadFile;
1418
+ /** 更新应用文件信息 */
1419
+ private updateAppFileInfo;
1420
+ /** 提交审核 */
1421
+ private submitForReview;
1422
+ /** 获取应用信息 */
1423
+ private getAppInfo;
1424
+ /** 上传商店素材(图标、截图、视频) */
1425
+ private uploadStoreAssets;
1426
+ /** 批量上传素材文件 */
1427
+ private uploadAssetFiles;
1428
+ /** 更新素材文件信息(关联到应用) */
1429
+ private updateAssetFileInfo;
1430
+ }
1431
+
1432
+ /**
1433
+ * 小米应用商店上传器
1434
+ *
1435
+ * 基于小米官方「应用自动发布接口」实现
1436
+ * 文档: https://dev.mi.com/xiaomihyperos/documentation/detail?pId=1134
1437
+ *
1438
+ * 上传流程:
1439
+ * 1. 构建 RequestData JSON (userName, appInfo, synchroType)
1440
+ * 2. 计算所有参数的 MD5 (RequestData 字符串 + APK 文件)
1441
+ * 3. 拼接 SIG JSON, 用 RSA 公钥加密
1442
+ * 4. POST multipart/form-data 到 /dev/push
1443
+ */
1444
+ declare class XiaomiUploader implements IUploader {
645
1445
  name: string;
646
1446
  private static readonly API_BASE;
647
1447
  private static readonly PUSH_API;
@@ -687,13 +1487,11 @@ declare class XiaomiUploader implements IUploader {
687
1487
  validateConfig(config: any): boolean;
688
1488
  canHandle(filePath: string): boolean;
689
1489
  /**
690
- * 查询应用状态
691
- * 使用 POST /dev/query 接口,需要 SIG 签名认证
692
- *
693
- * 返回值说明:
694
- * - create: true → 需要通过新增方式上传 (synchroType=0)
695
- * - updateVersion: true → 可以更新包 (synchroType=1)
696
- * - updateInfo: true → 可以仅更新信息 (synchroType=2)
1490
+ * 查询本账号包状态;仅成功响应的明确许可决定新增或更新,其余结果中止自动模式。
1491
+ * @param userName 小米开发者账号邮箱。
1492
+ * @param packageName 本次已确认的目标应用包名。
1493
+ * @param privateKey API 访问密码,仅参与 SIG 加密,不是账号登录密码。
1494
+ * @param publicKeyObj 平台公钥,用于加密查询 SIG。
697
1495
  */
698
1496
  private queryAppStatus;
699
1497
  /**
@@ -704,7 +1502,17 @@ declare class XiaomiUploader implements IUploader {
704
1502
  categoryId: number;
705
1503
  categoryName: string;
706
1504
  }[] | null>;
1505
+ /**
1506
+ * 按明确上传类型或查询许可提交本次安装包;自动查询失败不继续推送。
1507
+ * @param filePath 单包默认路径,元数据产物字典存在时使用字典。
1508
+ * @param config 已确认的小米目标配置、认证材料与可选首发资料。
1509
+ * @param metadata 本次版本、更新日志及可选架构产物映射。
1510
+ */
707
1511
  upload(filePath: string, config: any, metadata: AppMetadata): Promise<UploadResult>;
1512
+ /**
1513
+ * 组装已决定的上传动作、文件摘要与 RSA SIG,单次推送至小米审核接口。
1514
+ * @param params 已确认的新增或更新动作、账号、公钥、安装包映射及可选商店资料;素材只按现有支持范围发送,不自动重试。
1515
+ */
708
1516
  private performUpload;
709
1517
  /**
710
1518
  * 解析公钥: 优先使用内容字段, 其次从文件路径读取
@@ -750,12 +1558,16 @@ declare class AppleStoreUploader implements IUploader {
750
1558
  */
751
1559
  canHandle(filePath: string): boolean;
752
1560
  /**
753
- * 执行上传流程
1561
+ * 执行一次 IPA 上传;可选发行说明更新仍可重试,上传失败必须人工核对后另行执行。
1562
+ * @param filePath 已确认的 IPA 本地路径。
1563
+ * @param config App Store 配置、账号材料及发行说明请求的重试设置。
1564
+ * @param metadata 本次版本信息与可选更新日志。
754
1565
  */
755
1566
  upload(filePath: string, config: any, metadata: AppMetadata): Promise<UploadResult>;
756
1567
  /**
757
- * 使用可用的工具上传
758
- * 策略: 优先 Transporter → 降级 altool → 都失败
1568
+ * 先探测工具,再执行一次上传;探测失败可选备选工具,上传执行失败不得隐式二次上传。
1569
+ * @param ipaPath 本次人工确认的 IPA 路径。
1570
+ * @param auth 本次 Apple ID 与 App 专用密码,仅传递给选定工具。
759
1571
  */
760
1572
  private uploadWithAvailableTool;
761
1573
  /**
@@ -765,233 +1577,48 @@ declare class AppleStoreUploader implements IUploader {
765
1577
  /**
766
1578
  * 通过 Transporter CLI 上传
767
1579
  */
768
- private uploadViaTransporter;
769
- /**
770
- * 通过 altool 上传
771
- */
772
- private uploadViaAltool;
773
- /**
774
- * 解析 altool/Transporter 错误信息,翻译为用户友好的语言
775
- */
776
- private parseAltoolError;
777
- /**
778
- * 检查是否配置了 API Key 凭据
779
- */
780
- private hasApiCredentials;
781
- /**
782
- * 创建 JWT 生成器
783
- */
784
- private createJWTGenerator;
785
- /**
786
- * 获取 API 请求头
787
- */
788
- private apiHeaders;
789
- /**
790
- * 尝试更新发行说明(失败不影响上传结果)
791
- */
792
- private tryUpdateReleaseNotes;
793
- /**
794
- * 获取处于"准备提交"状态的版本
795
- * 只有此状态下的版本才能修改发行说明
796
- */
797
- private getPrepareForSubmissionVersion;
798
- /**
799
- * 获取版本的本地化信息列表
800
- */
801
- private getVersionLocalizations;
802
- /**
803
- * 更新本地化版本的 What's New 内容
804
- */
805
- private updateLocalizationWhatsNew;
806
- /**
807
- * 获取工具安装指引
808
- */
809
- private getToolInstallationGuide;
810
- }
811
-
812
- /**
813
- * TestFlight 上传器
814
- *
815
- * 用于上传应用到 TestFlight 进行 Beta 测试
816
- * 参考: https://developer.apple.com/documentation/appstoreconnectapi/build-beta-versions
817
- */
818
- declare class TestFlightUploader implements IUploader {
819
- name: string;
820
- private static readonly API_ROOT;
821
- private static readonly API_TIMEOUT;
822
- private static readonly BUILD_PROCESSING_TIMEOUT;
823
- private static readonly BUILD_POLLING_INTERVAL;
824
- /**
825
- * 验证配置
826
- * @param config 配置对象
827
- */
828
- validateConfig(config: any): boolean;
829
- /**
830
- * 判断是否支持该文件
831
- * @param filePath 文件路径
832
- */
833
- canHandle(filePath: string): boolean;
834
- /**
835
- * 执行上传到 TestFlight
836
- * @param filePath 文件路径
837
- * @param config 配置
838
- * @param metadata 元数据
839
- */
840
- upload(filePath: string, config: any, metadata: AppMetadata): Promise<UploadResult>;
841
- /**
842
- * 加载 JWT 生成器
843
- * @param auth 认证信息
844
- */
845
- private loadJWTGenerator;
846
- /**
847
- * 提取 Bundle ID
848
- * @param ipaPath IPA 路径
849
- */
850
- private extractBundleId;
851
- /**
852
- * 创建构建记录
853
- * @param jwt JWT
854
- * @param bundleId Bundle ID
855
- * @param version 版本号
856
- */
857
- private createBuild;
858
- /**
859
- * 上传 IPA 文件
860
- * @param jwt JWT
861
- * @param buildId 构建 ID
862
- * @param filePath 文件路径
863
- */
864
- private uploadIPAFile;
865
- /**
866
- * 等待构建处理
867
- * @param jwt JWT
868
- * @param buildId 构建 ID
869
- * @param timeoutMs 超时时间
870
- */
871
- private waitForBuildProcessing;
872
- /**
873
- * 创建 Beta 版本(使其可测试)
874
- * @param jwt JWT
875
- * @param buildId 构建 ID
876
- */
877
- private createBetaBuildVersion;
878
- /**
879
- * Add beta testers to the build
880
- */
881
- private addBetaTesters;
882
- /**
883
- * 添加单个测试员到组
884
- * @param jwt JWT
885
- * @param testerEmail 测试员邮箱
886
- * @param buildId 构建 ID
887
- */
888
- private addBetaTesterToGroup;
889
- /**
890
- * Add localization for beta build
891
- */
892
- private addBetaBuildLocalization;
893
- /**
894
- * Add single localization
895
- */
896
- private addLocalizationToBuilder;
897
- /**
898
- * 通知测试员
899
- * @param jwt JWT
900
- * @param buildId 构建 ID
901
- * @param message 消息
902
- */
903
- private notifyBetaTesters;
904
- }
905
-
906
- /**
907
- * Ad Hoc 上传器
908
- *
909
- * 用于创建 Ad Hoc 分发包,供特定设备安装
910
- * Ad Hoc 允许在最多 100 个特定的 iOS 设备上安装应用
911
- *
912
- * 流程:
913
- * 1. 使用 Xcode 生成 Ad Hoc IPA(使用指定的 Provisioning Profile)
914
- * 2. 生成设备安装链接/二维码
915
- * 3. 支持通过蒲公英或其他分发平台
916
- */
917
- declare class AdHocUploader implements IUploader {
918
- name: string;
919
- /**
920
- * 验证配置
921
- * @param config 配置对象
922
- * @returns 是否有效
923
- */
924
- validateConfig(config: any): boolean;
925
- /**
926
- * 判断是否支持该文件
927
- * @param filePath 文件路径
928
- * @returns 是否支持
929
- */
930
- canHandle(filePath: string): boolean;
1580
+ private uploadViaTransporter;
931
1581
  /**
932
- * 执行上传(生成 Ad Hoc 分发包)
933
- * @param filePath 文件路径
934
- * @param config 配置
935
- * @param metadata 元数据
1582
+ * 通过 altool 上传
936
1583
  */
937
- upload(filePath: string, config: any, metadata: AppMetadata): Promise<UploadResult>;
1584
+ private uploadViaAltool;
938
1585
  /**
939
- * 从 IPA 提取 Bundle ID
940
- * @param ipaPath IPA 路径
1586
+ * 解析 altool/Transporter 错误信息,翻译为用户友好的语言
941
1587
  */
942
- private extractBundleId;
1588
+ private parseAltoolError;
943
1589
  /**
944
- * 验证 Provisioning Profile
945
- * @param profileSpecifier Profile 名称
946
- * @param teamId 团队 ID
1590
+ * 检查是否配置了 API Key 凭据
947
1591
  */
948
- private verifyProvisioningProfile;
1592
+ private hasApiCredentials;
949
1593
  /**
950
- * 创建 manifest.plist 文件
951
- * @param ipaPath IPA 路径
952
- * @param version 版本号
953
- * @param bundleId Bundle ID
954
- * @param changelog 更新日志
1594
+ * 创建 JWT 生成器
955
1595
  */
956
- private createManifest;
1596
+ private createJWTGenerator;
957
1597
  /**
958
- * 设置分发目录结构
959
- * @param ipaPath IPA 路径
960
- * @param manifestPath Manifest 路径
1598
+ * 获取 API 请求头
961
1599
  */
962
- private setupDistributionDirectory;
1600
+ private apiHeaders;
963
1601
  /**
964
- * 生成安装链接 (itms-services)
965
- * @param distributionPath 分发目录
966
- * @param bundleId Bundle ID
1602
+ * 尝试更新发行说明(失败不影响上传结果)
967
1603
  */
968
- private generateInstallUrl;
1604
+ private tryUpdateReleaseNotes;
969
1605
  /**
970
- * 生成二维码
971
- * @param url 安装链接
972
- * @param distributionPath 分发目录
1606
+ * 获取处于"准备提交"状态的版本
1607
+ * 只有此状态下的版本才能修改发行说明
973
1608
  */
974
- private generateQRCode;
1609
+ private getPrepareForSubmissionVersion;
975
1610
  /**
976
- * 输出分发信息
977
- * @param installUrl 安装链接
978
- * @param qrCodePath 二维码路径
979
- * @param distributionPath 分发目录
980
- * @param profileInfo Profile 信息
1611
+ * 获取版本的本地化信息列表
981
1612
  */
982
- private outputDistributionInfo;
1613
+ private getVersionLocalizations;
983
1614
  /**
984
- * 检查是否安装了 Xcode
985
- * @returns 是否安装
1615
+ * 更新本地化版本的 What's New 内容
986
1616
  */
987
- private checkXcodeInstalled;
1617
+ private updateLocalizationWhatsNew;
988
1618
  /**
989
- * 生成 Ad Hoc 导出选项 (ExportOptions.plist)
990
- * @param teamId 团队 ID
991
- * @param signingIdentity 签名证书
992
- * @param provisioningProfile Profile 名称
1619
+ * 获取工具安装指引
993
1620
  */
994
- private generateExportOptions;
1621
+ private getToolInstallationGuide;
995
1622
  }
996
1623
 
997
1624
  /**
@@ -1002,12 +1629,19 @@ declare class HarmonyUploader implements IUploader {
1002
1629
  name: string;
1003
1630
  private static TOKEN_URL;
1004
1631
  private static PUBLISH_API_ROOT;
1632
+ private static PUBLISH_API_V3_ROOT;
1005
1633
  validateConfig(config: any): boolean;
1006
1634
  /**
1007
1635
  * 判断是否支持该文件
1008
1636
  * @param filePath 文件路径
1009
1637
  */
1010
1638
  canHandle(filePath: string): boolean;
1639
+ /**
1640
+ * 上传文件并关联鸿蒙草稿;不等待软件包解析,不执行送审。
1641
+ * @param filePath 已确认的 APP 或兼容 HAP 本地路径。
1642
+ * @param config 已确认的鸿蒙应用配置与内存认证材料。
1643
+ * @param metadata 本次版本元数据及旧入口单语言说明;草稿关联不据此推断解析结果。
1644
+ */
1011
1645
  upload(filePath: string, config: any, metadata: AppMetadata): Promise<UploadResult>;
1012
1646
  /**
1013
1647
  * 获取 Access Token
@@ -1018,14 +1652,25 @@ declare class HarmonyUploader implements IUploader {
1018
1652
  /**
1019
1653
  * 获取上传 URL
1020
1654
  * @param token Token
1655
+ * @param clientId 客户端 ID
1021
1656
  * @param appId 应用 ID
1022
1657
  * @param suffix 后缀
1023
1658
  */
1024
1659
  private getUploadUrl;
1025
1660
  private uploadFile;
1661
+ /**
1662
+ * 使用 HarmonyOS Upload Management API 上传 App Pack。
1663
+ *
1664
+ * 分片地址是华为返回的短时效签名地址,必须原样使用其请求头,并在合并时回传每片 ETag。
1665
+ */
1666
+ private uploadAppPack;
1667
+ private parseUploadHeaders;
1668
+ private assertHuaweiSuccess;
1669
+ private updateHarmonyAppPackageInfo;
1026
1670
  /**
1027
1671
  * 更新应用文件信息
1028
1672
  * @param token Token
1673
+ * @param clientId 客户端 ID
1029
1674
  * @param appId 应用 ID
1030
1675
  * @param authCode 授权码
1031
1676
  * @param filePath 文件路径
@@ -1094,28 +1739,73 @@ declare class OppoUploader implements IUploader {
1094
1739
  * 提交版本信息
1095
1740
  */
1096
1741
  private submitVersion;
1097
- /**
1098
- * 格式化错误信息
1099
- */
1100
- private formatError;
1742
+ /** 只提取平台错误码与脱敏后的短消息,禁止传播完整响应。 */
1743
+ private createApiError;
1101
1744
  }
1102
1745
 
1103
- /**
1104
- * vivo 应用商店上传器
1105
- *
1106
- * 基于 vivo 开放平台「应用分发 API」实现 (协议与腾讯开放平台 Open-QQ 规范一致)
1107
- * 文档: https://dev.vivo.com.cn/documentCenter/doc/326
1108
- */
1746
+ /** vivo 应用分发 API 适配器,成功仅表示审核已提交。 */
1109
1747
  declare class VivoUploader implements IUploader {
1748
+ /** 上传管理器中的渠道名称。 */
1110
1749
  name: string;
1111
- /** vivo 开放 API 基础地址 */
1750
+ /** 官方生产路由,隔离验证不向此地址发起真实请求。 */
1112
1751
  private static readonly API_BASE;
1752
+ /**
1753
+ * 按 ASCII 键序计算未编码参数的 HMAC-SHA256;文件内容不参与参数拼串。
1754
+ * @param params 本次实际发送的参数,不包含 sign 与 file。
1755
+ * @param accessSecret 当前账号的签名密钥,仅用于内存计算。
1756
+ */
1113
1757
  private generateSign;
1758
+ /**
1759
+ * 校验渠道已启用且具备签名材料,返回是否可执行。
1760
+ * @param config 内存中的完整发布配置。
1761
+ */
1114
1762
  validateConfig(config: any): boolean;
1763
+ /**
1764
+ * 判断文件扩展名是否属于当前 APK 上传能力。
1765
+ * @param filePath 待分配到该渠道的安装包路径,扩展名忽略大小写。
1766
+ */
1115
1767
  canHandle(filePath: string): boolean;
1768
+ /**
1769
+ * 上传选定 APK 并同步更新;任一协议失败都返回失败,不继续报告审核成功。
1770
+ * @param filePath 单包默认路径;元数据提供产物字典时使用该字典。
1771
+ * @param config 已由调用方核对并确认的发布配置与账号材料。
1772
+ * @param metadata 本次版本、更新日志及可选的架构产物映射。
1773
+ */
1116
1774
  upload(filePath: string, config: any, metadata: AppMetadata): Promise<UploadResult>;
1775
+ /**
1776
+ * 以流式读取计算上传文件的 MD5,文件错误交由调用方中止上传。
1777
+ * @param filePath 已核对存在的 APK 路径。
1778
+ */
1117
1779
  private calculateFileMD5;
1780
+ /**
1781
+ * 创建公共参数;按接入总表及 Java 示例使用 HMAC-SHA256,不因失败切换旧 hmac 重传。
1782
+ * @param accessKey 当前 vivo 账号接入标识。
1783
+ * @param method 当前普通包或分包的官方方法名称。
1784
+ */
1785
+ private commonParams;
1786
+ /**
1787
+ * 检查网关及业务返回码;可选 subCode 缺省视为无子错误,非零或畸形码均拒绝。
1788
+ * @param data 平台原始响应,仅错误摘要会经过脱敏后输出。
1789
+ * @param operation 当前失败阶段的可读名称。
1790
+ */
1791
+ private assertSuccess;
1792
+ /**
1793
+ * 使用对应 APK 方法上传并返回文件流水号,成功响应缺少流水号也必须中止。
1794
+ * @param accessKey 当前 vivo 账号接入标识。
1795
+ * @param accessSecret 本次请求签名密钥。
1796
+ * @param filePath 待上传的 APK 普通文件路径。
1797
+ * @param packageName 已核对的目标包名。
1798
+ * @param fileMd5 本地 APK 的小写 MD5。
1799
+ * @param kind 单包、32 位分包或 64 位分包,决定上传方法。
1800
+ */
1118
1801
  private uploadApk;
1802
+ /**
1803
+ * 同步更新应用;普通包发送 apk、版本号与 MD5,分包发送 apk32/apk64。
1804
+ * @param accessKey 当前 vivo 账号接入标识。
1805
+ * @param accessSecret 本次请求签名密钥。
1806
+ * @param data 已组装的包名、上线方式、设备及本次上传流水号。
1807
+ * @param split 是否使用官方分包更新方法。
1808
+ */
1119
1809
  private submitVersion;
1120
1810
  }
1121
1811
 
@@ -1144,6 +1834,12 @@ declare class TencentUploader implements IUploader {
1144
1834
  private generateSign;
1145
1835
  validateConfig(config: any): boolean;
1146
1836
  canHandle(filePath: string): boolean;
1837
+ /**
1838
+ * 上传本次产物并保留线上应用资料,包开关和流水号由本次选择重建。
1839
+ * @param filePath 单包默认路径,元数据有产物字典时优先使用字典。
1840
+ * @param config 已确认的应用宝配置和账号材料。
1841
+ * @param metadata 本次版本、更新日志与可选架构映射。
1842
+ */
1147
1843
  upload(filePath: string, config: any, metadata: AppMetadata): Promise<UploadResult>;
1148
1844
  /**
1149
1845
  * 阶段 1: 获取文件上传信息
@@ -1158,7 +1854,11 @@ declare class TencentUploader implements IUploader {
1158
1854
  */
1159
1855
  private uploadToCos;
1160
1856
  /**
1161
- * 阶段 3: 提交流水号信息
1857
+ * 保留应用资料并以本次上传结果重建包字段,防止线上旧架构继续参与送审。
1858
+ * @param auth 已确认的 userId、appId 和签名密钥。
1859
+ * @param data 线上应用资料与本次更新说明,所有 apk32/apk64 字段均忽略。
1860
+ * @param packages 本次已上传的安装包;不能混入线上流水号。
1861
+ * @param options 可选请求配置;timeout 为毫秒,缺省使用 Axios 默认超时。
1162
1862
  */
1163
1863
  private submitModifyAppInfo;
1164
1864
  }
@@ -1166,9 +1866,15 @@ declare class TencentUploader implements IUploader {
1166
1866
  interface GooglePlayHttpResponse<T = any> {
1167
1867
  data: T;
1168
1868
  }
1869
+ /** Google 官方 API 的最小 HTTP 边界,允许隔离验证远端副作用。 */
1169
1870
  interface GooglePlayHttpClient {
1871
+ /** 只读查询轨道或包列表;配置只携带当前认证头。 */
1872
+ get<T = any>(url: string, config?: any): Promise<GooglePlayHttpResponse<T>>;
1873
+ /** 创建事务、上传包或提交已校验事务。 */
1170
1874
  post<T = any>(url: string, data?: any, config?: any): Promise<GooglePlayHttpResponse<T>>;
1875
+ /** 保存完整轨道草稿配置,调用方保留旧发行条目。 */
1171
1876
  put<T = any>(url: string, data?: any, config?: any): Promise<GooglePlayHttpResponse<T>>;
1877
+ /** 清理本次创建且尚未提交的事务。 */
1172
1878
  delete<T = any>(url: string, config?: any): Promise<GooglePlayHttpResponse<T>>;
1173
1879
  }
1174
1880
  interface GooglePlayAuthConfig {
@@ -1182,20 +1888,50 @@ interface GooglePlayUploaderDependencies {
1182
1888
  /**
1183
1889
  * Google Play 上传器。
1184
1890
  *
1185
- * 首版能力刻意限制为:上传一个 AAB 到内部测试轨道并保留为 draft。
1186
- * 配置层与 Google Play API 都使用 internal 作为内部测试轨道标识。
1891
+ * 支持 internal 或 production 草稿,保留所选轨道已有的有效发行条目。
1892
+ * production 草稿不等于提交审核或正式发布。
1187
1893
  * 创建应用、填写商店资料、提交审核和生产发布均不在此适配器范围内。
1188
1894
  */
1189
1895
  declare class GooglePlayUploader implements IUploader {
1190
1896
  name: string;
1191
1897
  private readonly httpClient;
1192
1898
  private readonly getAccessToken;
1899
+ /**
1900
+ * 注入正式 HTTP 或隔离测试边界,不在构造时读取凭据或访问远端。
1901
+ * @param dependencies 可选 HTTP 与取令牌函数;省略时使用 Axios 和本机 GoogleAuth。
1902
+ */
1193
1903
  constructor(dependencies?: GooglePlayUploaderDependencies);
1904
+ /**
1905
+ * 校验明确轨道和服务账号来源,不触发远端动作。
1906
+ * @param config 当前发布配置;仅接受 internal 或 production 草稿。
1907
+ */
1194
1908
  validateConfig(config: any): boolean;
1909
+ /**
1910
+ * 根据后缀选择 AAB 上传器;实际身份由执行边界另行核对。
1911
+ * @param filePath 待上传的本地文件路径,不接受 APK。
1912
+ */
1195
1913
  canHandle(filePath: string): boolean;
1196
- upload(filePath: string, config: any, _metadata: AppMetadata): Promise<UploadResult>;
1914
+ /**
1915
+ * 核对远端构建号,并在 production 事务预校验通过后发送 AAB;保留原发行及上传后的校验与回读。
1916
+ * @param filePath 已确认身份和摘要的 AAB 路径。
1917
+ * @param config 明确轨道、内存认证材料与可选 BCP-47 发行说明。
1918
+ * @param metadata 当前计划绑定的应用版本和内部构建号。
1919
+ * @returns 草稿受理和回读结果;失败保留是否已提交的事实,禁止自动重传。
1920
+ */
1921
+ upload(filePath: string, config: any, metadata: AppMetadata): Promise<UploadResult>;
1922
+ /**
1923
+ * 核对回读保留旧版本及当前草稿正文,不接受静默丢失旧包或语言。
1924
+ * @param actual 当前 GET 返回的轨道对象。
1925
+ * @param expected 本次 PUT 的完整发行条目,包含原有条目和新草稿。
1926
+ */
1927
+ private assertDraftMatches;
1197
1928
  private createAccessToken;
1198
1929
  private deleteEditBestEffort;
1930
+ /** 将HTTP或平台业务错误转为有阶段和轨道的脱敏说明,不把所有403归因于同一种权限。
1931
+ * @param error - 当前请求捕获的供应商异常;原请求头和凭据不能进入结果。
1932
+ * @param stage - 失败时的实际上传阶段,用于区分包接收、轨道更新及提交。
1933
+ * @param track - 当前明确选择的internal或production草稿轨道。
1934
+ */
1199
1935
  private describeError;
1200
1936
  private redactAndTruncate;
1201
1937
  private failure;
@@ -1268,90 +2004,6 @@ declare const DEFAULT_RETRY_CONFIG: RetryConfig;
1268
2004
  */
1269
2005
  declare function createUploadRetryStrategy(config?: RetryConfig): RetryStrategy;
1270
2006
 
1271
- /**
1272
- * 上传管理器配置
1273
- */
1274
- interface UploadManagerConfig {
1275
- maxConcurrent?: number;
1276
- continueOnError?: boolean;
1277
- verbose?: boolean;
1278
- cancellationToken?: {
1279
- isCancelled: boolean;
1280
- };
1281
- }
1282
- /**
1283
- * 聚合的上传结果报告
1284
- */
1285
- interface UploadReport {
1286
- totalUploads: number;
1287
- successCount: number;
1288
- failureCount: number;
1289
- successPlatforms: string[];
1290
- failurePlatforms: string[];
1291
- results: UploadResult[];
1292
- totalDurationMs: number;
1293
- summary: string;
1294
- }
1295
- /**
1296
- * 上传管理器 - 处理多平台并行上传
1297
- */
1298
- declare class UploadManager {
1299
- private uploaders;
1300
- private config;
1301
- constructor(config?: UploadManagerConfig);
1302
- /**
1303
- * 注册上传器
1304
- */
1305
- registerUploader(platform: string, uploader: IUploader): void;
1306
- /**
1307
- * 获取启用的平台列表(根据配置)
1308
- */
1309
- getEnabledPlatforms(config: any): string[];
1310
- /**
1311
- * 获取可用的平台列表
1312
- */
1313
- getAvailablePlatforms(): string[];
1314
- /**
1315
- * 执行并行上传(支持多文件智能分发)
1316
- */
1317
- uploadToMultiplePlatforms(filePaths: string | string[], // 支持单文件或文件数组
1318
- config: any, metadata: AppMetadata, targetPlatforms?: string[]): Promise<UploadReport>;
1319
- /**
1320
- * 上传到单个平台
1321
- */
1322
- private uploadToPlatform;
1323
- private shouldGroupArtifacts;
1324
- private resolveArtifactSelection;
1325
- private buildArtifactMapFromFiles;
1326
- private inferArtifactKey;
1327
- private getRepresentativeFilePath;
1328
- private validateArtifactSelection;
1329
- /**
1330
- * 聚合上传结果
1331
- */
1332
- private aggregateResults;
1333
- /**
1334
- * 输出上传报告
1335
- */
1336
- private printReport;
1337
- /**
1338
- * 格式化持续时间
1339
- */
1340
- private formatDuration;
1341
- /**
1342
- * 获取可重试的失败平台
1343
- */
1344
- getRetryablePlatforms(report: UploadReport): string[];
1345
- /**
1346
- * 重试失败的平台
1347
- */
1348
- retryFailedPlatforms(failedPlatforms: string[], filePath: string | string[], config: any, metadata: AppMetadata): Promise<UploadReport>;
1349
- }
1350
- /**
1351
- * 创建上传管理器实例
1352
- */
1353
- declare function createUploadManager(config?: UploadManagerConfig): UploadManager;
1354
-
1355
2007
  /**
1356
2008
  * Apple App Store Connect API JWT 生成器
1357
2009
  *
@@ -1431,97 +2083,223 @@ interface ParseOptions {
1431
2083
  /**
1432
2084
  * 从安装包文件中解析版本信息
1433
2085
  *
1434
- * 支持三种格式:
1435
- * - APK: 使用 aapt2/aapt(Android SDK 自带)
2086
+ * 支持常见发布格式:
2087
+ * - APK/AAB: 使用 aapt2/aapt(Android SDK 自带)
1436
2088
  * - IPA: 使用 unzip + plutil(macOS 原生)
1437
- * - HAP: 使用 unzip(系统自带)
2089
+ * - HAP/APP: 使用 unzip(系统自带)
1438
2090
  *
1439
2091
  * 解析失败时返回 null,不会抛出异常
1440
2092
  */
1441
2093
  declare function parsePackageInfo(filePath: string, options?: ParseOptions): Promise<PackageInfo | null>;
1442
2094
 
1443
- declare const RELEASE_RECEIPT_SCHEMA_VERSION: 1;
1444
- declare const DEFAULT_RELEASE_RECEIPT_LIMIT = 100;
1445
- type ReleaseReceiptKind = 'build' | 'upload';
1446
- type ReleaseReceiptOutcome = 'success' | 'partial' | 'failed' | 'cancelled';
1447
- type ReleaseReceiptState = 'built' | 'uploaded' | 'draft_created' | 'review_submitted' | 'reviewing' | 'approved' | 'rejected' | 'released' | 'failed' | 'cancelled';
1448
- interface ReleaseArtifactReceipt {
1449
- path: string;
1450
- name: string;
1451
- sizeBytes?: number;
1452
- sha256?: string;
1453
- available: boolean;
2095
+ /** 可信发布入口使用的格式限制,与 MCP 预览保持一致。 */
2096
+ declare function expectedFormatsForPlatform(platform: ReleasePlatform): string[];
2097
+ /** 上传前需要核对的产物平台。 */
2098
+ type ArtifactIdentityPlatform = 'android' | 'harmony' | 'ios';
2099
+ interface ArtifactIdentity {
2100
+ platform: ArtifactIdentityPlatform;
2101
+ artifactPath: string;
2102
+ packageName: string;
2103
+ source: 'apk' | 'aab' | 'hap' | 'app' | 'ipa';
2104
+ packageInfo: PackageInfo;
1454
2105
  }
1455
- interface ReleaseRemoteReceipt {
1456
- consoleUrl?: string;
1457
- downloadUrl?: string;
1458
- identifiers?: Record<string, string | number | boolean>;
2106
+ /**
2107
+ * 根据上传平台返回产物身份平台。
2108
+ * 蒲公英等分发平台没有自己的包格式约束,因此按实际后缀判断。
2109
+ */
2110
+ declare function inferArtifactIdentityPlatform(uploadPlatform: string, artifactPath: string): ArtifactIdentityPlatform | null;
2111
+ /**
2112
+ * 读取安装包内的真实应用身份。
2113
+ * 解析失败必须抛错,由调用方在适配器发起任何网络请求前阻断上传。
2114
+ */
2115
+ declare function inspectArtifactIdentity(artifactPath: string, platform: ArtifactIdentityPlatform, metadata?: Partial<AppMetadata>): Promise<ArtifactIdentity>;
2116
+ /**
2117
+ * 解析单个平台配置中的包名。平台字段优先;只有历史上把顶层 appId
2118
+ * 当作包名的分发平台才允许回退。Huawei/Harmony 的 appId 是商店应用 ID,
2119
+ * 不能拿来和安装包内 bundle/package name 比较。
2120
+ */
2121
+ declare function resolveExpectedArtifactPackageName(config: any, uploadPlatform: string): string | undefined;
2122
+ /**
2123
+ * 对一个上传任务的所有候选产物执行身份核对。
2124
+ * 没有配置平台包名时不自行推断,保留既有“由适配器或平台侧决定”的兼容行为。
2125
+ */
2126
+ declare function assertArtifactIdentityMatches(uploadPlatform: string, artifactPaths: string[], config: any, metadata?: Partial<AppMetadata>): Promise<ArtifactIdentity[]>;
2127
+
2128
+ /** 将可能含凭据的任意文本转换为可安全输出的短文本。 */
2129
+ declare function redactSecretText(value: unknown, maxLength?: number): string;
2130
+ /** 只保留安全消息与非敏感诊断字段,禁止把原始 HTTP 请求对象继续向上传递。 */
2131
+ declare function createRedactedError(error: unknown, fallback?: string): Error;
2132
+
2133
+ declare const ADDITIONAL_STORES: readonly ["honor", "meizu", "samsung"];
2134
+ type AdditionalStore = (typeof ADDITIONAL_STORES)[number];
2135
+ type StoreFailureCode = 'invalid_credentials' | 'rejected' | 'application_not_found' | 'ambiguous_application' | 'application_mismatch' | 'invalid_response' | 'network_unavailable' | 'cancelled' | 'application_not_ready' | 'lookup_limit_exceeded';
2136
+ declare class StorePublishingError extends Error {
2137
+ readonly code: StoreFailureCode;
2138
+ constructor(code: StoreFailureCode);
1459
2139
  }
1460
- interface ReleaseTargetReceipt {
1461
- platform: string;
1462
- state: ReleaseReceiptState;
1463
- outcome: ReleaseReceiptOutcome;
1464
- message: string;
1465
- remote?: ReleaseRemoteReceipt;
1466
- lastKnownRemoteStatus?: string;
1467
- checkedAt?: string;
2140
+ declare const storeRecord: (value: unknown) => Record<string, any>;
2141
+ declare function storeIdentifier(value: unknown): string;
2142
+ declare function credentialField(value: unknown): string;
2143
+ /** 三星私钥只在本机签名;只申请 publishing 范围,不请求统计或其他服务。 */
2144
+ declare function createSamsungJwt(accountId: string, privateKey: string, now?: number): string;
2145
+ /** 魅族签名按字段名排序并追加客户端密钥;不把秘密放到 URL 查询串。 */
2146
+ declare function createMeizuHeaders(clientId: string, clientSecret: string, uri: string, accessToken: string, timestamp?: string, traceId?: `${string}-${string}-${string}-${string}-${string}`): Record<string, string>;
2147
+ interface StoreApplication {
2148
+ appId: string;
2149
+ packageName: string;
2150
+ /** 仅供本机上传适配器,严禁把应用详情直接投影到日志或模型。 */
2151
+ detail?: Record<string, any>;
1468
2152
  }
1469
- interface ReleaseReceipt {
1470
- schemaVersion: typeof RELEASE_RECEIPT_SCHEMA_VERSION;
1471
- id: string;
1472
- projectKey: string;
1473
- projectRoot: string;
1474
- kind: ReleaseReceiptKind;
1475
- appName?: string;
1476
- packageName?: string;
1477
- versionName?: string;
1478
- buildNumber?: string;
1479
- changelog?: string;
1480
- artifacts: ReleaseArtifactReceipt[];
1481
- targets: ReleaseTargetReceipt[];
1482
- outcome: ReleaseReceiptOutcome;
1483
- startedAt: string;
1484
- finishedAt: string;
1485
- durationMs: number;
2153
+ /** 固定域名上的有界 JSON 传输;上传文件由适配器的流式 multipart 边界负责。 */
2154
+ declare class StorePublishingClient {
2155
+ readonly platform: AdditionalStore;
2156
+ private readonly material;
2157
+ private readonly transport;
2158
+ private readonly signal?;
2159
+ private token;
2160
+ private authenticated;
2161
+ constructor(platform: AdditionalStore, material: CredentialMaterial, transport?: typeof fetch, signal?: AbortSignal | undefined);
2162
+ get authenticationVerified(): boolean;
2163
+ headers(uri: string): Record<string, string>;
2164
+ url(uri: string, query?: Record<string, string>): url.URL;
2165
+ private request;
2166
+ authenticate(): Promise<void>;
2167
+ /** 通用请求仅接受本适配器固定域名上的相对路径。 */
2168
+ json(uri: string, query?: Record<string, string>, body?: unknown): Promise<any>;
2169
+ /** 精确包名匹配;列表不完整、多候选或既有应用 ID 冲突时均停止。 */
2170
+ application(packageName: string, expectedAppId?: string): Promise<StoreApplication>;
1486
2171
  }
1487
- interface ReleaseReceiptInput {
2172
+
2173
+ /** 只摘要实际会改变上传目标/设备配置的公开字段,秘密及秘密摘要不进入计划。 */
2174
+ declare function storeTargetFingerprint(target: any): string;
2175
+ /** 计划使用 APK 内的包名和版本;同一计划只绑定一个具体 APK。 */
2176
+ declare function prepareStoreRelease(config: UploadConfig, platform: AdditionalStore, file: string, metadata?: Partial<AppMetadata>): Promise<ReleasePlan>;
2177
+
2178
+ /** 私钥路径只在本机解析,限制普通文件和大小,不把原文拼进错误。 */
2179
+ declare function storeCredentialMaterial(auth: any): Promise<CredentialMaterial>;
2180
+ type StoreFileTransport = (url: string, form: FormData, options: {
2181
+ headers: Record<string, string>;
2182
+ onUploadProgress?: (event: {
2183
+ loaded: number;
2184
+ total?: number;
2185
+ }) => void;
2186
+ }) => Promise<unknown>;
2187
+ declare class StoreUploader implements IUploader {
2188
+ readonly platform: AdditionalStore;
2189
+ private readonly transport;
2190
+ private readonly fileTransport;
2191
+ readonly name: string;
2192
+ constructor(platform: AdditionalStore, transport?: typeof fetch, fileTransport?: StoreFileTransport);
2193
+ canHandle(file: string): boolean;
2194
+ validateConfig(config: any): boolean;
2195
+ upload(filePath: string, config: any, _metadata: AppMetadata, onProgress?: ReleaseProgressObserver): Promise<UploadResult>;
2196
+ }
2197
+
2198
+ /** 本次已支持原生确认的商店渠道,普通草稿渠道与既有新增商店共享可信执行器。 */
2199
+ type ConfirmedStorePlatform = AdditionalStore | 'huawei' | 'harmony' | 'google_play';
2200
+ /** 宿主未获得明确人工批准时的终止信号;不代表商店上传失败。 */
2201
+ declare class ReleaseConfirmationDeclinedError extends Error {
2202
+ /** 创建未批准结果;此时尚未解析凭据或发送安装包。 */
2203
+ constructor();
2204
+ }
2205
+ /** 将真实产物计划交给本机宿主确认,再执行并保存脱敏回执;取消不解析 Profile。
2206
+ * @param input - 当前渠道配置、真实产物、可信人工确认回调及可选隔离测试依赖。
2207
+ */
2208
+ declare function executeConfirmedStoreRelease(input: {
2209
+ /** 本次渠道的独立配置快照,保留根本地化日志。 */
2210
+ config: UploadConfig;
2211
+ /** 本次明确选择的受支持商店。 */
2212
+ platform: ConfirmedStorePlatform;
2213
+ /** 当前一个具体安装包,不接受表单伪造的身份。 */
2214
+ file: string;
2215
+ /** 原项目绝对目录,用于回执和相对私密文件路径。 */
1488
2216
  projectRoot: string;
1489
- kind: ReleaseReceiptKind;
1490
- appName?: string;
1491
- packageName?: string;
1492
- versionName?: string;
1493
- buildNumber?: string | number;
1494
- changelog?: string;
1495
- artifactPaths?: unknown;
1496
- targets: ReleaseTargetReceipt[];
1497
- startedAt?: string | number | Date;
1498
- finishedAt?: string | number | Date;
1499
- outcome?: ReleaseReceiptOutcome;
2217
+ /** 原配置路径;省略时没有磁盘配置可复验。 */
2218
+ configPath?: string;
2219
+ /** 可选日志和工具参数,实际版本仍以安装包为准。 */
2220
+ metadata?: Partial<AppMetadata>;
2221
+ /** 可选取消信号,在远端发送前生效。 */
2222
+ signal?: AbortSignal;
2223
+ /** 真实宿主向人展示绑定计划并返回明确选择,默认值不视为批准。 */
2224
+ approve: (plan: ReleasePlan) => Promise<boolean>;
2225
+ /** 可选可信依赖替身,只供受控本机或隔离测试。 */
2226
+ dependencies?: ReleaseExecutorDependencies;
2227
+ }): Promise<ReleaseExecutionResult>;
2228
+
2229
+ /**
2230
+ * 按用户动作配置或核验项目凭据,不依赖上传开关;完成核验后才写入公开引用。
2231
+ * @param input - 当前项目的凭据动作、配置路径或已有采集任务;不改变渠道启用状态。
2232
+ * @param signal - 可选取消信号,向只读核验传递。
2233
+ * @param assertCurrent - 可选宿主归属检查,在完成配置写入前调用。
2234
+ */
2235
+ declare function runCredentialCommand(input: {
2236
+ /** 本次明确发起的采集、查询、完成、取消或只读体检动作。 */
2237
+ action: 'setup' | 'status' | 'complete' | 'cancel' | 'preflight';
2238
+ /** 开始采集或体检必填的已保存项目配置路径,其余动作省略。 */
2239
+ configPath?: string;
2240
+ /** 开始采集或体检必填的商店渠道标识,其余动作省略。 */
2241
+ platform?: string;
2242
+ /** 查询、完成或取消时必填的本机采集任务标识。 */
2243
+ setupId?: string;
2244
+ /** 仅开始采集时有效,true 创建新档案,省略或 false 复用已有档案。 */
2245
+ refreshExisting?: boolean;
2246
+ }, signal?: AbortSignal, assertCurrent?: () => void): Promise<PublishPreflight | CredentialSetupStatus>;
2247
+
2248
+ /** 同一次发行按语言共用的说明正文;语言必须显式匹配商店的语言标识。 */
2249
+ type LocalizedReleaseNotes = Record<string, string>;
2250
+ /**
2251
+ * 校验可选本地化说明;省略时保持旧调用不设置本地化正文的语义。
2252
+ * @param value - 配置中的语言到正文映射;空映射、空正文与下划线语言标识均拒绝。
2253
+ * @returns 独立的已校验映射;未配置时返回 undefined。
2254
+ */
2255
+ declare function readLocalizedReleaseNotes(value: unknown): LocalizedReleaseNotes | undefined;
2256
+
2257
+ /** 两个华为发布 API 共用的请求身份,仅在可信本机执行期间持有。 */
2258
+ interface HuaweiReleaseNotesContext {
2259
+ /** 当前平台已选定的官方发布 API 根路径,Android 使用 v2,鸿蒙使用 v3。 */
2260
+ apiRoot: string;
2261
+ /** 已按包名核对的商店应用 ID。 */
2262
+ appId: string;
2263
+ /** 已鉴权的请求头;不得记录或持久化其中的令牌。 */
2264
+ headers: Record<string, string>;
1500
2265
  }
1501
- interface ReleaseReceiptStoreOptions {
1502
- storageRoot?: string;
1503
- maxEntries?: number;
2266
+ /** 回读确认后的版本说明,未配置的商店语言不会被创建。 */
2267
+ interface HuaweiReleaseNotesResult {
2268
+ /** 远端已存在且本次正文回读一致的语言及正文。 */
2269
+ verified: LocalizedReleaseNotes;
2270
+ /** 输入提供但远端尚未配置的语言,不自动新增名称和描述。 */
2271
+ unavailableLocales: string[];
1504
2272
  }
1505
- /** 解析发布回执所属项目;显式项目目录优先,未提供时才使用配置文件目录。 */
1506
- declare function resolveReleaseProjectRoot(projectRoot: string | undefined, configPath: string): string;
1507
- /** 将可能包含凭据的错误信息压缩为可安全持久化的短文本。 */
1508
- declare function sanitizeReleaseMessage(value: unknown, maxLength?: number): string;
1509
- /** 将上传结果转换为稳定、可公开展示的渠道状态。 */
1510
- declare function createUploadTargets(results: UploadResult[]): ReleaseTargetReceipt[];
1511
- /** 创建回执;只接受已经挑选过的业务字段,不接受完整配置或原始响应。 */
1512
- declare function createReleaseReceipt(input: ReleaseReceiptInput): Promise<ReleaseReceipt>;
1513
- /** 将回执转换为适合复制给客户或 AI 的纯文本摘要。 */
1514
- declare function formatReleaseReceipt(receipt: ReleaseReceipt): string;
1515
- declare class ReleaseReceiptStore {
1516
- private readonly storageRoot;
1517
- private readonly maxEntries;
1518
- constructor(options?: ReleaseReceiptStoreOptions);
1519
- append(receipt: ReleaseReceipt): Promise<void>;
1520
- list(projectRoot: string, limit?: number): Promise<ReleaseReceipt[]>;
1521
- save(input: ReleaseReceiptInput): Promise<ReleaseReceipt>;
1522
- private getFilePath;
1523
- private readFile;
2273
+ /**
2274
+ * 仅更新远端已有语言的 newFeatures,并逐项回读正文和原有素材字段。
2275
+ * @param context - 当前平台的已鉴权官方 API 身份,函数不会修改该身份。
2276
+ * @param configuredNotes - 按 BCP-47 显式配置的正文,省略时才使用旧单语言说明。
2277
+ * @param legacyChangelog - 旧入口的单语言正文,仅写入远端默认语言;空值不发请求。
2278
+ * @returns 已回读的语言正文及未配置语言;更新或回读失败直接抛错,不报告成功。
2279
+ */
2280
+ declare function updateHuaweiReleaseNotes(context: HuaweiReleaseNotesContext, configuredNotes: unknown, legacyChangelog: string): Promise<HuaweiReleaseNotesResult>;
2281
+
2282
+ /** 本次真实安装包的只读身份,版本与摘要均来自文件本身。 */
2283
+ interface InspectedArtifact {
2284
+ /** 已解析的绝对普通文件路径。 */ path: string;
2285
+ /** 安装包实际格式,不从表单覆盖。 */ format: string;
2286
+ /** 包内实际应用标识。 */ packageName: string;
2287
+ /** 包内非空用户版本。 */ versionName: string;
2288
+ /** 包内非空构建号字符串。 */ buildNumber: string;
2289
+ /** 读取完成时实际字节数。 */ sizeBytes: number;
2290
+ /** 同一次文件读取的 SHA-256。 */ sha256: string;
1524
2291
  }
1525
- declare function createProjectKey(projectRoot: string): string;
2292
+ /** 从普通安装包读取身份并校验读取期间未变化,不接受外部版本覆盖。
2293
+ * @param artifactPath - 用户选定的本地安装包路径,解析为绝对路径后读取。
2294
+ * @returns 包内身份、大小与同一次读取摘要。
2295
+ */
2296
+ declare function inspectReleaseArtifact(artifactPath: string): Promise<InspectedArtifact>;
2297
+ /** 为现有产物生成与实际文件绑定的测试分发或商店计划,不读取账号。
2298
+ * @param artifactPath - 需要检查的当前产物路径,不能用旧包代替。
2299
+ * @param platform - 已明确选择的目标渠道。
2300
+ * @param credentialProfile - 本次执行引用的本机 Profile 名称,不包含秘密。
2301
+ * @param distributionAccess - 蒲公英安装权限;其他渠道或未指定时省略。
2302
+ */
2303
+ declare function previewArtifactRelease(artifactPath: string, platform: ReleasePlatform, credentialProfile: string, distributionAccess?: 'public' | 'password' | 'invite'): Promise<ReleasePlan>;
1526
2304
 
1527
- export { AdHocUploader, type AppMetadata, AppleJWTGenerator, AppleStoreUploader, type BuildResult, ConfigValidator, DEFAULT_RELEASE_RECEIPT_LIMIT, DEFAULT_RETRY_CONFIG, EnvValidator, ErrorCategory, GooglePlayUploader, type GooglePlayUploaderDependencies, HarmonyUploader, HuaweiUploader, type IUploader, OppoUploader, type PackageInfo, type ParseOptions, PgyerUploader, RELEASE_RECEIPT_SCHEMA_VERSION, type ReleaseArtifactReceipt, type ReleaseReceipt, type ReleaseReceiptInput, type ReleaseReceiptKind, type ReleaseReceiptOutcome, type ReleaseReceiptState, ReleaseReceiptStore, type ReleaseReceiptStoreOptions, type ReleaseRemoteReceipt, type ReleaseTargetReceipt, type RetryConfig, type RetryResult, RetryStrategy, TencentUploader, TestFlightUploader, type UploadConfig, UploadManager, type UploadManagerConfig, type UploadReport, type UploadResult, VivoUploader, XiaomiUploader, createProjectKey, createReleaseReceipt, createUploadManager, createUploadRetryStrategy, createUploadTargets, formatReleaseReceipt, parsePackageInfo, resolveReleaseProjectRoot, sanitizeReleaseMessage };
2305
+ export { ADDITIONAL_STORES, type AdditionalStore, type AndroidStoreConfig, type AppMetadata, AppleJWTGenerator, AppleStoreUploader, type ArtifactIdentity, type ArtifactIdentityPlatform, type BuildResult, CREDENTIAL_CONSOLES, ConfigValidator, type ConfirmedStorePlatform, type CredentialMaterial, type CredentialMigrationOptions, type CredentialMigrationResult, type CredentialProfileCatalog, type CredentialProfileMetadata, type CredentialProfileStore, type CredentialProfileWriteInput, type CredentialResolveRequest, type CredentialResolver, CredentialSetupService, type CredentialSetupStatus, type CredentialStorageKind, DEFAULT_CREDENTIAL_VAULT_PATH, DEFAULT_RELEASE_RECEIPT_LIMIT, DEFAULT_RETRY_CONFIG, EnvValidator, ErrorCategory, GooglePlayUploader, type GooglePlayUploaderDependencies, HarmonyUploader, type HuaweiReleaseNotesContext, type HuaweiReleaseNotesResult, HuaweiUploader, type IUploader, type InspectedArtifact, LocalCredentialProfileStore, type LocalizedReleaseNotes, MacOSKeychainSecretStore, OppoUploader, PREFLIGHT_CODES, PREFLIGHT_PLATFORMS, type PackageInfo, type ParseOptions, type PgyerCredentialVerification, PgyerUploader, type PreflightCode, type PreflightPlatform, type PublishPreflight, RELEASE_PLATFORM_CAPABILITIES, RELEASE_RECEIPT_SCHEMA_VERSION, type ReleaseAction, type ReleaseAfterApproval, type ReleaseArtifactBinding, type ReleaseArtifactReceipt, type ReleaseBatchExecutionResult, type ReleaseCancelUntil, type ReleaseChannelKind, type ReleaseConfirmation, ReleaseConfirmationDeclinedError, type ReleaseExecutionInput, type ReleaseExecutionResult, type ReleaseExecutorDependencies, type ReleasePlan, type ReleasePlanInput, type ReleasePlatform, type ReleasePlatformCapability, type ReleaseProgress, type ReleaseProgressObserver, type ReleaseReceipt, type ReleaseReceiptInput, type ReleaseReceiptKind, type ReleaseReceiptOutcome, type ReleaseReceiptState, ReleaseReceiptStore, type ReleaseReceiptStoreOptions, type ReleaseRemoteReceipt, type ReleaseResultingState, type ReleaseRiskLevel, type ReleaseTargetReceipt, type ReleaseWithdrawal, type RetryConfig, type RetryResult, RetryStrategy, type SecretStore, type SecurityCommandResult, type SecurityCommandRunner, type StoreApplication, type StoreFailureCode, type StoreFileTransport, StorePublishingClient, StorePublishingError, StoreUploader, TencentUploader, type UploadConfig, UploadManager, type UploadManagerConfig, type UploadReport, type UploadResult, VivoUploader, XiaomiUploader, assertArtifactIdentityMatches, assertCredentialProfileName, assertPublishPackageName, assertReleaseArtifactMatchesPlan, assertReleaseConfirmation, assertSafeCredentialMetadata, createDefaultCredentialProfileStore, createHuaweiServiceAccountToken, createMeizuHeaders, createProjectKey, createRedactedError, createReleasePlan, createReleaseReceipt, createSamsungJwt, createUploadManager, createUploadRetryStrategy, createUploadTargets, credentialField, credentialPagePlatform, executeConfirmedStoreRelease, executeReleasePlan, executeReleasePlans, expectedFormatsForPlatform, formatReleasePlan, formatReleaseReceipt, hydrateCredentialProfiles, inferArtifactIdentityPlatform, inspectArtifactIdentity, inspectReleaseArtifact, isSubmissionAction, migrateLegacyCredentials, parseHuaweiServiceAccount, parsePackageInfo, preflightPublish, prepareStoreRelease, previewArtifactRelease, readLocalizedReleaseNotes, redactSecretText, resolveExpectedArtifactPackageName, resolveInlineCredentialMaterial, resolveReleaseProjectRoot, rollbackCredentialProfiles, runCredentialCommand, sanitizeReleaseMessage, storeCredentialMaterial, storeIdentifier, storeRecord, storeTargetFingerprint, updateHuaweiReleaseNotes, verifyPgyerCredentialProfile };