import type { Express, RequestHandler } from "express"; import type { GitHubApkDownload } from "./distribution-manager.js"; import type { ModelCatalogService } from "./models.js"; import type { PackageUpdateInfo, UpdateChannel } from "./npm-update-utils.js"; import { type ProviderCliUpdateStatus } from "./provider-cli-updater.js"; import type { WandStorage } from "./storage.js"; import type { WandConfig } from "./types.js"; interface DownloadAsset { fileName: string; filePath: string; size: number; } interface ResolvedUpdateAsset { version: string; downloadUrl: string; fileName: string; size: number; source: "local" | "github"; releaseNotes?: string; sha256?: string; } export interface PublicUpdateRoutesDependencies { resolveLatestApk(channel: "stable" | "beta"): Promise; resolveAndroidDownload(channel: "stable" | "beta"): Promise; /** GitHub 来源由服务端代拉,避免手机直连 CDN。测试 stub 可不实现。 */ resolveGitHubApkDownload?(): Promise; /** Beta 包下发时清理分发目录,只保留最新一个 APK(可选,测试 stub 可不实现)。 */ pruneAndroidApkDirectory?(keepFileName?: string): Promise<{ deleted: string[]; freedBytes: number; }>; /** 计算本地分发文件的 SHA-256(hex);失败返回 null,下载响应不带哈希头。 */ computeAssetSha256(asset: DownloadAsset): Promise; resolveLatestDmg(): Promise; resolveMacosDownload(): Promise; resolveLatestIpa(): Promise; resolveIosDownload(): Promise; } export declare function registerPublicUpdateRoutes(app: Express, deps: PublicUpdateRoutesDependencies): void; export declare class ServerUpdateState { providerCliUpdateCache: { items: ProviderCliUpdateStatus[]; checkedAt: string; } | null; providerCliUpdateInFlight: boolean; updateInFlight: boolean; } export declare function refreshProviderCliUpdateState(state: ServerUpdateState, config: WandConfig): Promise<{ items: ProviderCliUpdateStatus[]; checkedAt: string; }>; export interface AdminUpdateRoutesDependencies { storage: WandStorage; config: WandConfig; configPath: string; requireAdmin: RequestHandler; state: ServerUpdateState; getDistributionSettings(): Promise<{ androidApk: Record; macosDmg: Record; iosIpa: Record; }>; modelCatalog: ModelCatalogService; getUpdateChannel(): UpdateChannel; checkLatestPackageVersion(channel: UpdateChannel, forceRefresh?: boolean): Promise; buildInfo: { commit: string | null; builtAt: string | null; channel: string | null; }; serverInstanceId: string; emitSystemNotification(data: Record): void; } export declare function registerAdminUpdateRoutes(app: Express, deps: AdminUpdateRoutesDependencies): void; export {};