fix(runtime): freeze miniapp kind vocabulary

This commit is contained in:
2026-08-06 01:31:38 +08:00
parent b81a0edcca
commit 44b6a83a30
4 changed files with 10 additions and 7 deletions
@@ -52,8 +52,12 @@ export type CoreAppRecord = {
manifest: AppManifest;
};
/** Transitional input accepted while older host adapters are upgraded. */
export type CoreAppRecordInput = Omit<CoreAppRecord, "kind"> & { kind: MiniAppKind | "core" | "extension" };
/**
* The Runtime installation boundary uses the frozen SDK v1 vocabulary.
* Legacy host labels (`core` / `extension`) are intentionally not accepted
* here; callers must migrate before they can register an App.
*/
export type CoreAppRecordInput = Omit<CoreAppRecord, "kind"> & { kind: MiniAppKind };
const INITIAL_CORE_APPS: readonly CoreAppRecord[] = [
{
@@ -132,8 +136,7 @@ export class CoreAppRegistry {
if (!isAppScope(record.app_scope) || record.manifest.app_scope !== record.app_scope) throw new Error("Core App Registry received an invalid app_scope.");
if (this.apps.has(record.app_scope)) throw new Error(`Core App Registry has duplicate app_scope: ${record.app_scope}`);
if (!isManifest(record.manifest)) throw new Error(`Core App Registry has an invalid manifest: ${record.app_scope}`);
const kind: MiniAppKind = record.kind === "core" ? "system" : record.kind === "extension" ? "bundled" : record.kind;
this.apps.set(record.app_scope, copyRecord({ ...record, kind }));
this.apps.set(record.app_scope, copyRecord(record));
}
}